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
pooja Agichapooja Agicha 

To diaplay String in comma seprated format

Hi All,

 

I have a string which contains the numberic values.I want to display the values with comma seperated.

eg: string value is : 20000,the visualforce page shuld render this as 20,000.

 

I tried using  

<apex:outputText value="string: {0,Number,$#,###.##}">

<apex:param value="{!AccountBusinessDetails.PermCredLnAmt}" />

</apex:outputText>

for this value should be number do I aaded the folloeing statement in my controller class.

Decimal.valueof(AccountBusinessDetails.PermCredLnAmt);// this is out put from Webservice

 

I am getting error "Value should be a number/date/decimal format".

 

Any help is appreciated.

 

Thanks.

 

Cool_DevloperCool_Devloper

use Integer.valueOf()

Cool_D

pooja Agichapooja Agicha

If I keep the value in decimal ,on VF page for large numbers it displays the value in an Exponential format eg: 2.5E13 .So that is the reason I converted it into string ,but for String I am not able to format it as currency .

 

Cool_DevloperCool_Devloper

I think you can use "<apex:outputField>". that should render the number fields in the correct format!

Cool_D

pooja Agichapooja Agicha

<Apex:OutputField> can only be used with the sobject fields.The value I am trying to render is a result of webservice object,that is not created as a object in salesforce.

 

Cool_DevloperCool_Devloper

Well, in that case, why don't you use some string functions on the VF page itself, using which you can check the length of your string and add the "," appropriately!

Cool_D