Debug.Log(string.Format("90000:{0}",ClientTools.ConvertNumToKM(90000)));<pre name="code" class="csharp">public static string ConvertNumToKM(int num)
{
float value = 0;
string result = num.ToString();
if (num >= 1000000)
{
value = num / 1000000f;
result = string.Format("{0:N1}M", value);
}
else if (num >= 1000)
{
value = num / 1000f;
result = string.Format("{0:N1}K", value);<span style="color:#ff0000;">// 90000 = 90.0K</span>
}
return result;
}
数字 转换成 .千百万
最新推荐文章于 2021-10-14 14:54:19 发布