function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShamSham 

Bug with outputText formatting

I am using outputText to format some values.

Here is my code

 



<apex:page>
<apex:outputText value="{0,number,##,##,##,###.00}">
<apex:param value="{!1000000}" />
</apex:outputText>
<br/>
<apex:outputText value="{0,number,#,#,#,#.00}">
<apex:param value="{!10000000}" />
</apex:outputText>
</apex:page>

Interestingly the first formatting doesn't comes out proper,While the second is proper.

The first should display 10,00,000.00 instead of 1,000,000.00 (note the misplaced comma)

 

Has anybody encoutered a similar issue

 

 

 

aballardaballard

As described in the documentation,  formats work the same as the Java MessageFormat classes (in fact, use the Java MessageFormat classes).

 

Here is what the referenced Java doc says about this....

 

If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####".

 

So in your case, you get a group size of 3. 

 

Sounds like it is working as designed.  Even if not how you might expect.