public void AddLast(FRngString value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            AddLastInternal(new FMultiRngString(value.str, value.sidx, value.eidx));
        }
        public StringContext(FRngString value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            str  = value.str;
            sidx = value.sidx;
            eidx = value.eidx;
        }
        public static HashedString ToHashedString(this FRngString value)
        {
#if DEBUG
            if (value is null)
            {
                throw new System.ArgumentNullException(nameof(value));
            }
#endif
            int sidx = value.sidx;
            int cnt  = value.eidx - sidx;
            return(new HashedString(value.str.GetFixedHashcode(sidx, cnt), cnt));
        }
        public static bool TryToInt32(this FRngString value, out int result)
        {
            string str  = value.str;
            int    sidx = value.sidx;
            int    eidx = value.eidx;

            char first = str[sidx];

            int locr;

            if (char.IsDigit(first))
            {
                locr = first - '0';
            }
            else
            {
                sidx++;
                locr = 0;
            }

            for (; sidx < eidx; sidx++)
            {
                char c = str[sidx];
                if (!char.IsDigit(c))
                {
                    result = 0;
                    return(false);
                }
                else
                {
                    locr = locr * 10 + (c - '0');
                }
            }

            result =
                first == '-'
                ? -locr
                : locr;
            return(true);
        }
        public void Add(FRngString value)
        {
            if (closed)
            {
                throw new InvalidOperationException();
            }
            else if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (str != value.str)
            {
                throw new InvalidOperationException();
            }
            else if (value.sidx < sidx)
            {
                sidx = value.sidx;
            }
            else
            {
                eidx = value.eidx;
            }
        }
示例#6
0
 public FCharEnumerator(FRngString value) : this(value.str, value.sidx, value.eidx)
 {
 }
 public static float ToFloat(this FRngString value) => float.Parse(value.ToString());
 public static double ToDouble(this FRngString value) => double.Parse(value.ToString());
 public static decimal ToDecimal(this FRngString value) => decimal.Parse(value.ToString());
 public static int ToInt32(this FRngString value)
 {
     TryToInt32(value, out int result);
     return(result);
 }
 public FMultiRngString(FRngString value) : this(value.str, value.sidx, value.eidx)
 {
 }