コード
using UnityEngine;
public static class MathUtility
{
<summary>
</summary>
<param name="num"></param>
<returns></returns>
public static int Digit(ulong num)
{
System.Text.StringBuilder Sb = new System.Text.StringBuilder();
Sb.Append(num);
return Sb.Length;
}
<summary>
</summary>
<param name="num"></param>
<returns></returns>
public static string GetCountText(ulong num)
{
var Length = Digit(num);
System.Text.StringBuilder Sb = new System.Text.StringBuilder();
Sb.Append(num);
var text = Sb.ToString();
if (Length < 4)
{
}
else if (Length < 7)
{
var k = "k";
text = text.Insert(text.Length - 3, ".");
text = text + k;
}
else if (Length < 10)
{
var m = "m";
text = text.RemoveEnd(3);
text = text.Insert(text.Length - 3, ".");
text = text + m;
}
else
{
var b = "b";
text = text.RemoveEnd(6);
text = text.Insert(text.Length - 3, ".");
text = text + b;
}
return text;
}
}