UnityEngine.TextEditor.FindEndOfClassification C# (CSharp) Method

FindEndOfClassification() private method

private FindEndOfClassification ( int p, int dir ) : int
p int
dir int
return int
        private int FindEndOfClassification(int p, int dir)
        {
            int length = this.text.Length;
            if ((p >= length) || (p < 0))
            {
                return p;
            }
            CharacterType type = this.ClassifyChar(this.text[p]);
            do
            {
                p += dir;
                if (p < 0)
                {
                    return 0;
                }
                if (p >= length)
                {
                    return length;
                }
            }
            while (this.ClassifyChar(this.text[p]) == type);
            if (dir == 1)
            {
                return p;
            }
            return (p + 1);
        }