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
Karthik TathiReddyKarthik TathiReddy 

Any method to describe the given number in 4 digit format

Hi,

Is there any method in Apex to print the the given input number in 4 digit format. For example my input numbers are 2,3,4,5,6,23,24. Then the output should be like 0002,0003,0004,0005,0006,0023,0024.

How could I achieve this with out writing general logic? If any methods resulting this output could appreciate. Please help on this....

 

 

Regards-

Shiv Kumar

Best Answer chosen by Admin (Salesforce Developers) 
SeAlVaSeAlVa

If you want that only for displaying purposes, try the following

<apex:outputText value="{0, number, 0000}" >
    <apex:param value="{!variableToDisplayWithFormat}"/>
</apex:outputText>

 Regards