- Home /
Currency String Format
Hello Guys,
I want to display my number(stored as string ) as currency.
float numFloat=12314143253453454;
string numStr="12314143253453454";
//This one prints correct
Debug.Log (String.Format("Order Total: {0:C}", numFloat));
//This one doesnt
Debug.Log (String.Format("Order Total: {0:C}", numStr));
I have even tried CultureInfo , but all that works if the number is int/float/long etc (not string).
So is there a way to achieve this when my number is stored as STRING(i have very large numbers say 100 digit) ?
Answer by Kriogenic · Feb 06, 2015 at 05:16 AM
You could try this.
Debug.Log (String.Format("Order Total: {0:C}", float.Parse(numStr)));
this will parse your string to a float.
Thanx Bro ... You just gave me a nice idea . Thumbs Up
Problem with float is that it converts digits to zero after 7th digit.Though its not the answer to my question.
Anyways u just made my day ... Thanks
Your answer
Follow this Question
Related Questions
Seperate large numbers with comma 2 Answers
Can't Convert string binary to long. 2 Answers
format text block in GUI.Box 1 Answer
String format not working 1 Answer
Highscores Input wrong Format Error 1 Answer