How to shorten number in C# unity

What im wanting to know is like, say i have the number 1000, i dont want it to show 1000 i want it to show 1K, or i have 1000000, i want it to show 1M. Any help, please!

You have to do this yourself in c#

Perhaps something like this:

    public string ChangeNumber(decimal amount)
        string value;
        if (amount >= 1000000)
            value = Math.Floor(amount / 1000000).ToString() + "M";
        else if (amount >= 1000)
            value = Math.Floor(amount / 1000).ToString() + "K";
            value = amount.ToString();

        return value;

//call it like var value = ChangeNumber(122222);

If you don’t want to truncate, but round, use round instead of floor.