Class StringUtil

java.lang.Object
org.apache.tinkerpop.gremlin.util.StringUtil

public final class StringUtil extends Object
Utility class for Strings.
Author:
Andrea Child
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Determines whether the given string is a syntactically valid Java identifier, to the same effect as javax.lang.model.SourceVersion#isIdentifier(CharSequence) without requiring the java.compiler module.
    static List<String>
    split(String toSplit, String separator)
    Splits the provided string into a List of string by the given separator, which will not be included in the returned List.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • split

      public static List<String> split(String toSplit, String separator)
      Splits the provided string into a List of string by the given separator, which will not be included in the returned List.
      Parameters:
      toSplit - the string to split
      separator - the separator string to split by - empty will split into a List of characters
      Returns:
      a List of parsed strings, not including the given separator
    • isIdentifier

      public static boolean isIdentifier(String s)
      Determines whether the given string is a syntactically valid Java identifier, to the same effect as javax.lang.model.SourceVersion#isIdentifier(CharSequence) without requiring the java.compiler module. A string is a valid identifier if it is non-empty, its first code point satisfies Character.isJavaIdentifierStart(int), and every other code point satisfies Character.isJavaIdentifierPart(int). Unlike SourceVersion.isName(), reserved keywords are not rejected.
      Parameters:
      s - the string to test
      Returns:
      true if s is a valid Java identifier