| | |
| | | /// 大数值转化 格式 最多两个小数 ,向下取整 |
| | | /// K -千,M -百萬,B-十億,T -萬億 |
| | | /// </summary> |
| | | public static string ReplaceLargeNum(double num) |
| | | public static string ReplaceLargeNum(double num, int decimalPlaces = 1) |
| | | { |
| | | const long K = 10000; //国内为万,海外为千 |
| | | const long M = K * 10000; |
| | |
| | | } |
| | | else if (num >= M) |
| | | { |
| | | return StringUtility.Contact(FormatWithoutRounding(num / M, 1), Language.Get("L1070")); |
| | | return StringUtility.Contact(FormatWithoutRounding(num / M, decimalPlaces), Language.Get("L1070")); |
| | | } |
| | | else if (num >= K) |
| | | { |
| | | return StringUtility.Contact(FormatWithoutRounding(num / K, 1), Language.Get("L1071")); |
| | | return StringUtility.Contact(FormatWithoutRounding(num / K, decimalPlaces), Language.Get("L1071")); |
| | | } |
| | | else |
| | | { |
| | | return FormatWithoutRounding(num, 1); |
| | | return FormatWithoutRounding(num, decimalPlaces); |
| | | } |
| | | } |
| | | |