Class Strings


  • @API(status=INTERNAL,
         since="2020.1.0")
    public final class Strings
    extends Object
    The usual, static class with helper methods centered around missing functionality in String. Not supported for external use in anyway.
    Since:
    2020.1.0
    Author:
    Michael J. Simons
    • Method Detail

      • hasText

        public static boolean hasText​(String str)
        Parameters:
        str - A string to be checked for text.
        Returns:
        True, if the strign is neither null nor empty nor blank.
      • randomIdentifier

        public static String randomIdentifier​(int length)
        Parameters:
        length - The length of the identifier to generate.
        Returns:
        A random identifier that is a valid identifier
      • isIdentifier

        public static boolean isIdentifier​(CharSequence name)
        This is a literal copy of javax.lang.model.SourceVersion#isIdentifier(CharSequence) included here to be not dependent on the compiler module.
        Parameters:
        name - A possible Java identifier
        Returns:
        True, if name represents an identifier.
      • isValidJavaIdentifierPartAt

        public static boolean isValidJavaIdentifierPartAt​(int p,
                                                          int codePoint)
        A convenience method to decide whether a given codePoint is a valid Java identifier at the given position p.
        Parameters:
        p - Position on which the codePoint is supposed to be used as identifier
        codePoint - A codepoint
        Returns:
        True if the codePoint could be used as part of an identifier at the given position