Class Strings


  • @API(status=INTERNAL,
         since="2020.1.0")
    public final class Strings
    extends java.lang.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 Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean hasText​(java.lang.String str)  
      static boolean isIdentifier​(java.lang.CharSequence name)
      This is a literal copy of SourceVersion.isIdentifier(CharSequence) included here to be not dependent on the compiler module.
      static boolean isValidJavaIdentifierPartAt​(int p, int codePoint)
      A convinience method to decide whether a given codePoint is a valid Java identifier at the given position p.
      static java.lang.String randomIdentifier​(int length)  
      • Methods inherited from class java.lang.Object

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

      • hasText

        public static boolean hasText​(java.lang.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 java.lang.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​(java.lang.CharSequence name)
        This is a literal copy of 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 convinience 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