コード例 #1
0
        public void AddLast(FRngString value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            AddLastInternal(new FMultiRngString(value.str, value.sidx, value.eidx));
        }
コード例 #2
0
        public StringContext(FRngString value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            str  = value.str;
            sidx = value.sidx;
            eidx = value.eidx;
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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)
 {
 }
コード例 #7
0
 public static float ToFloat(this FRngString value) => float.Parse(value.ToString());
コード例 #8
0
 public static double ToDouble(this FRngString value) => double.Parse(value.ToString());
コード例 #9
0
 public static decimal ToDecimal(this FRngString value) => decimal.Parse(value.ToString());
コード例 #10
0
 public static int ToInt32(this FRngString value)
 {
     TryToInt32(value, out int result);
     return(result);
 }
コード例 #11
0
 public FMultiRngString(FRngString value) : this(value.str, value.sidx, value.eidx)
 {
 }