- Home /
Score display in specific format
I want to display game score in thousand separator format. I have written this kind of code for this purpose.
string format = "0,000,000";
gamePlayScoreText.text = GameManager.Instance.GamePlayScore.ToString (format);
By this code, I was getting this kind of output: 0,002,810
So from this, I want to remove leading zeros so my actual output will be: 2,810 So please give me some suggestion for this.
Have you tried using # ins$$anonymous$$d of 0?
https://msdn.microsoft.com/de-de/library/0c899ak8(v=vs.110).aspx
Answer by siddharth3322 · Oct 06, 2016 at 09:59 AM
I am pasting this answer to help other members but really thanks to @chillersanim for his awesome help.
I just converted my code to like this and its satisfy my requirement:
string format = "#,###,###";
gamePlayScoreText.text = GameManager.Instance.GamePlayScore.ToString (format);
Proper documentation, you can found here:
Your answer
Follow this Question
Related Questions
Score display error 1 Answer
Stacking Game - Add +1 Score on Collision - Show on GUItext 1 Answer
Creating a scoreboard 1 Answer
scoreboard 1 Answer