You need to sign in to do that
Don't have an account?
Wilder
How I can use string.format() ?
I need to get a integer value with leading zero in apex code
decimal Suff=20.0; list <string> ListS = new String[2]; ListS[0]='{###}'; ListS[1]='{000}'; system.debug(' -- DEBUG '+string.format(string.valueof(Suff),ListS));
printed in system console "20.0"
hi, Wilder
use below code to format value
public static String formatDoubleValue(Double d) {
Decimal val = Decimal.valueOf(d);
return val.setScale(2).toPlainString();
}
Hopes that will help you
regards,
Hitesh N. Patel
<apex:outputText value="{0, number, 0000}">
<apex:param value="{!var}" />
</apex:outputText>
but how can that value be used or generated in apex??
text = String.valueOf(number);
while (text.length() < 5)
{
text = '0' + text;
}