New UI system and money(int) format

Hi i need a help with my in-game money, i want to set format like this “100 000 Euro”, i was understand this on previous version but with this i don´t know how to do that, because i don´t using the onGUI but the new UI, i have already maked in-game money but i dont know how to make this format. Thanks for help :slight_smile:

    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;
    public class Hackers : MonoBehaviour {
    
    	public int money;
    
    	Text text;
    	void Start () {
    		text = GetComponent <Text> ();
    		money = 100000;
    	}
    	
    	// Update is called once per frame
    	void Update () {
    		text.text = "Money: " + money + " Euro";
    
    	}
    
    
    }

Based on the example you’ve given:

100000 → “100 000 Euro”

I assume that you want to use a space as a thousand separator (i.e. for each repeating group of three digits in the output), and append the units “Euro” on the end. You can do this by declaring a custom NumberFormatInfo class and passing it to ToString() as follows:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Globalization

public class Hackers : MonoBehaviour {

public int money;
Text text;
NumberFormatInfo nFI;

void Start () {
  text = GetComponent <Text> ();
  money = 100000;
  nFI = new NumberFormatInfo();
  nFI.NumberGroupSeparator = " ";

}

// Update is called once per frame
void Update () {
  text.text = "Money: " money.ToString("#,##0 Euro", nFI);
}

}