Esempio n. 1
0
        public static bool Split(this ReadOnlySpan <char> @this, char value0, SplitPartHandler partHandler)
        {
            int partIndex  = 0;
            int startIndex = 0;
            int commaIndex;
            int partLength;

            while ((commaIndex = @this.IndexOf(value0, startIndex)) >= 0)
            {
                partLength = commaIndex - startIndex;
                if (partLength > 0)
                {
                    if (!partHandler(@this.Slice(startIndex, partLength), partIndex))
                    {
                        return(false);
                    }

                    partIndex++;
                }

                startIndex = commaIndex + 1;
            }

            partLength = @this.Length - startIndex;
            return(partLength > 0 &&
                   partHandler(@this.Slice(startIndex, partLength), partIndex));
        }
Esempio n. 2
0
 public static bool SplitOnTabOrSpace(this ReadOnlySpan <char> @this, SplitPartHandler partHandler) =>
 @this.Split(' ', '\t', partHandler);