Пример #1
0
        public static int ExtractInt(this string value, int start, int count)
        {
            var intValue = 0;

            for (int n = 0, digit = (count - 1); n < count; ++n, --digit)
            {
                var ch = value[start + n];
                if (!char.IsNumber(ch))
                {
                    continue;
                }

                var number = ch - '0';
                if (0 == number)
                {
                    continue;
                }

                var scale = StringExtension.IntPow(10, (uint)digit);
                intValue += number * scale;
            }

            return(intValue);
        }
Пример #2
0
 public static string ToCommaSeparatedStringM(this decimal value, int digit = 3, int decimalDigit = 2, bool forceDigit = false)
 {
     return(StringExtension.ToSeparatedString(value, ',', digit, decimalDigit, forceDigit));
 }
Пример #3
0
 public static string ToCommaSeparatedStringUL(this ulong value, int digit = 3)
 {
     return(StringExtension.ToSeparatedString(value, ',', digit));
 }