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

losing locale settings when converting a number to a string

I have a custom object transaction__c with a custom field cost__c of type number(10,4). The cost is calculated as a quotient of two other fields of type number(10,4).

When I display cost__c in a visualforce page I see it in the following format: 0,9555 (my locale is set to german, hence the comma). However, if I first convert the value to a string (using string.valueof(transaction.cost__c)) and then display the string, I lose my locale settings (the comma in this case) and also the number is shown with more than 4 decimal places, for example 0.9554931231.

Is there a way to convert the number to a string without losing locale settings and the number of decimal places? Thanks, Alon

Thomas StrohThomas Stroh



Let me know if you were able to get an answer to your question, because I'm trying to sovle the same problems!


I'm also finding similar localization issues when converting a Picklist with TEXT and including this in a formula. If I have (2) values in my pick list (Value 1 & Value 2) and I have these converted to other languages, the Formula will always display "Value 1", for example, when the formula executes regardless of my current language settings.




Hi all,

I am having the same problem in a text Formula Field, since in the Netherlands we also use the comma decimal separator.


I try to put a number(13,5) Number__c in a text Formula with the TEXT() statement, but I get a dot-separated number instead of comma-separated one.


What I did to resolve it, is put 3 nested Substitute statements in the formula, so:



SUBSTITUTE( SUBSTITUTE( SUBSTITUTE(TEXT(Number__c),'.','|'), ',','.') '|',',')


Not very elegant but at this time I don't know of any alternatives.