Alsing.Text.PatternMatchers.PropertyPathPatterhMatcher.Match C# (CSharp) 메소드

Match() 공개 메소드

public Match ( string textToMatch, int matchAtIndex ) : int
textToMatch string
matchAtIndex int
리턴 int
        public override int Match(string textToMatch, int matchAtIndex)
        {
            bool start = true;

            int currentIndex = matchAtIndex;
            do
            {
                char currentChar = textToMatch[currentIndex];
                if (start && IsValidStartChar(currentChar))
                {
                    start = false;
                }
                else if (start && IsWildcard(currentChar))
                {
                    currentIndex++;
                    break;
                }
                else if (!start && IsSeparator(currentChar))
                {
                    start = true;
                }
                else if (!start && IsValidChar(currentChar)) {}
                else
                {
                    break;
                }
                currentIndex++;
            } while (currentIndex < textToMatch.Length);

            if (textToMatch.Substring(matchAtIndex, currentIndex - matchAtIndex) == "*")
                return 0;

            return currentIndex - matchAtIndex;
        }