Class StringScanner

java.lang.Object
com.helger.commons.string.util.StringScanner

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

  • Method Details

    • getCurrentIndex

      @Nonnegative public int getCurrentIndex()
    • getRemainingChars

      @Nonnegative public int getRemainingChars()
    • skipWhitespaces

      @Nonnull public StringScanner skipWhitespaces()
    • skipbackWhitespaces

      @Nonnull public StringScanner skipbackWhitespaces()
    • skip

      @Nonnull public StringScanner skip(int nCount)
    • findFirstIndex

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

      public char getCharAtIndex(int nIndex)
    • getCurrentChar

      public char getCurrentChar()
    • isCurrentChar

      public boolean isCurrentChar(char c)
    • setIndex

      @Nonnull public StringScanner setIndex(@Nonnegative int nIndex)
    • 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)
    • getUntilWhiteSpace

      @Nonnull public String getUntilWhiteSpace()
    • 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)
    • toString

      public String toString()
      Overrides:
      toString in class Object