Esempio n. 1
0
        /// <summary>Set the value at the specified subdivision index.</summary>
        /// <param name="index">Index to set.</param>
        /// <param name="value">New value.</param>
        private void SetValue(int index, string value)
        {
            PadSubDivider(index);
            var d = Divisions[index];

            Replace(d.Offset, d.Length, StringDividerOperations.GetChars(value));
        }
        /// <summary>Set the string value at the specified index.</summary>
        /// <param name="index">Index to change.</param>
        /// <param name="value">New value.</param>
        private void SetValue(int index, string value)
        {
            Pad(Delimiter, index, 0, _valueChars.Length, Divisions);
            var d = Divisions[index];

            Replace(d.Offset, d.Length, StringDividerOperations.GetChars(value));
        }
Esempio n. 3
0
        /// <summary>[PERF] Refresh internal division cache.</summary>
        private void Update()
        {
            Version = _baseDivider.Version;
            var baseDivision = _baseDivider.GetSubDivision(Index);

            if (baseDivision.Valid)
            {
                _divisions = StringDividerOperations.GetDivisions(BaseValue, Delimiter,
                                                                  _baseDivider.GetSubDivision(Index));
            }
            else
            {
                _divisions = new List <StringDivision>();
            }
        }
Esempio n. 4
0
 /// <summary>Create a divider for a specified string.</summary>
 /// <param name="s">String to divide.</param>
 /// <param name="delimiter">Delimiter to search for.</param>
 public RootStringDivider(string s, char delimiter)
 {
     Delimiter  = delimiter;
     ValueChars = StringDividerOperations.GetChars(s);
 }