FluffyManager.History.FormatCount C# (CSharp) Method

FormatCount() public method

public FormatCount ( float x, int unit = 1000, string suffixes = null ) : string
x float
unit int
suffixes string
return string
        public string FormatCount( float x, int unit = 1000, string[] suffixes = null )
        {
            if ( suffixes == null ) suffixes = new[] { "", "k", "M", "G" };
            int i = 0;
            while ( x > unit / 10 && i < suffixes.Length )
            {
                x /= unit;
                i++;
            }

            return x.ToString( "0.#" + suffixes[i] + Suffix );
        }