theartha
asked on
NumberFormat in c#
Hi There,
I am converting a piece of Java code to C#, I am having problems with NumberFormat. How to write the below java code in c#
Please advice.
Thanks.
I am converting a piece of Java code to C#, I am having problems with NumberFormat. How to write the below java code in c#
Please advice.
Thanks.
NumberFormat fmt;
String fmtValue;
StringBuffer buffer;
char charArray[];
int i;
fmt = NumberFormat.getCurrencyInstance();
fmtValue = fmt.format(value);
buffer = new StringBuffer();
charArray = fmtValue.toCharArray();
for(i = 0; i < charArray.length; i++){
if(Character.isDigit(charArray[i]) == true){
buffer.append(charArray[i]);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This solution works for me.
if value is double or float:
value.ToString("0,0.0")
value.ToString("0,0.0")
Open in new window