Class StringScanner


  • @NotThreadSafe
    public class StringScanner
    extends Object
    Simple string scanner.
    Author:
    Philip Helger
    • Constructor Detail

    • Method Detail

      • getCurrentIndex

        @Nonnegative
        public int getCurrentIndex()
      • getRemainingChars

        @Nonnegative
        public int getRemainingChars()
      • findFirstIndex

        public int findFirstIndex​(@Nonnull
                                  char... aChars)
      • getCharAtIndex

        public char getCharAtIndex​(int nIndex)
      • getCurrentChar

        public char getCurrentChar()
      • isCurrentChar

        public boolean isCurrentChar​(char c)
      • getRest

        @Nonnull
        public String getRest()
        Get all remaining chars, and set the index to the end of the input string
        Returns:
        The remaining string. May not be null but may be empty.
      • getUntilIndex

        @Nonnull
        public String getUntilIndex​(int nEndIndex)
      • getUntil

        @Nonnull
        public String getUntil​(char cEndExcl)
        Get the string until the specified end character, but excluding the end character.
        Parameters:
        cEndExcl - The end character to search.
        Returns:
        A non-null string with all characters from the current index until the end character, but not including the end character.
      • getUntilBalanced

        @Nonnull
        public String getUntilBalanced​(int nStartLevel,
                                       char cOpenChar,
                                       char cCloseChar)