Example #1
0
        public ReadOnlySpan <char> GetTextSpan()
        {
            if (NodeStart == -1)
            {
                if (Pos != null && End != null)
                {
                    return(SourceStr.AsSpan(Pos.Value, End.Value - Pos.Value));
                }
            }
            else if (End != null)
            {
                return(SourceStr.AsSpan(NodeStart, End.Value - NodeStart));
            }

            return(ReadOnlySpan <char> .Empty);
        }
Example #2
0
        private string AdjustSize(string SourceStr, int Size, char AppendChar)
        {
            int SourceSize = SourceStr.Length;

            if (SourceSize < Size)
            {
                for (int i = 0; i < Size - SourceSize; i++)
                {
                    SourceStr += AppendChar;
                }

                return(SourceStr);
            }
            else if (SourceSize > Size)
            {
                return(SourceStr.Remove(Size));
            }
            else
            {
                return(SourceStr);
            }
        }