| | |
| | | |
| | | |
| | | #region UI通用 |
| | | |
| | | //默认货币图片用高清的,富文本的可以用小图标利于排版显示 |
| | | public static void SetIconWithMoneyType(this Image _image, int moneyType) |
| | | { |
| | | if (_image == null) return; |
| | |
| | | /// 大数值转化 格式 最多两个小数 ,向下取整 |
| | | /// 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); |
| | | } |
| | | } |
| | | |
| | |
| | | //bool pureChinese = Regex.IsMatch(name, "^[\u4e00-\u9fa5]+$"); |
| | | //var chsCount = GetChsCount(name); |
| | | int length = Encoding.Default.GetBytes(name).Length; |
| | | var maxlength = 14; //纯中文不建议超过7个字 |
| | | var maxlength = 21; //纯中文不建议超过7个字 |
| | | var minlength = 3; |
| | | if (length > maxlength) |
| | | { |