Package 

Class StringUtils


  • @Deprecated() 
    public final class StringUtils
    
                        

    Implements utility functions to facilitate work with Strings.

    • Method Summary

      Modifier and Type Method Description
      static boolean isNullOrEmpty(String s) Checks whether a string is {@code null} or blank (empty or whitespace).
      static boolean isNullOrEmpty(String s, boolean trim) Indicates whether string is null or empty.
      static InputStream fromString(String string) Creates InputStream from the string in UTF8 encoding.
      static InputStream fromString(String string, String encoding) Creates InputStream from the string in the specified encoding.
      static Array<byte> getUTF8Bytes(String string) Returns the UTF8 bytes for string and handles the unlikely casewhere UTF-8 is not supported.
      static String getUTF8String(Array<byte> bytes) Converts string into an UTF8 String and handles theunlikely case where UTF-8 is not supported.
      static boolean containsLetters(String string) Indicates whether the given string contains any letters.
      static String newString(Array<byte> bytes) Initializes a new String instance by decoding a specified arrayof bytes (mostly used by JNI).
      • Methods inherited from class java.lang.Object

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

      • isNullOrEmpty

         static boolean isNullOrEmpty(String s)

        Checks whether a string is {@code null} or blank (empty or whitespace).

        Parameters:
        s - the string to analyze.
      • isNullOrEmpty

         static boolean isNullOrEmpty(String s, boolean trim)

        Indicates whether string is null or empty.

        Parameters:
        s - the string to analyze.
        trim - indicates whether to trim the string.
      • fromString

         static InputStream fromString(String string)

        Creates InputStream from the string in UTF8 encoding.

        Parameters:
        string - the string to convert.
      • fromString

         static InputStream fromString(String string, String encoding)

        Creates InputStream from the string in the specified encoding.

        Parameters:
        string - the string to convert.
        encoding - the encoding
      • getUTF8Bytes

         static Array<byte> getUTF8Bytes(String string)

        Returns the UTF8 bytes for string and handles the unlikely casewhere UTF-8 is not supported.

        Parameters:
        string - the String whose bytes we'd like to obtain.
      • getUTF8String

         static String getUTF8String(Array<byte> bytes)

        Converts string into an UTF8 String and handles theunlikely case where UTF-8 is not supported.

        Parameters:
        bytes - the byte array that we'd like to convert into aString.
      • containsLetters

         static boolean containsLetters(String string)

        Indicates whether the given string contains any letters.

        Parameters:
        string - the string to check for letters
      • newString

         static String newString(Array<byte> bytes)

        Initializes a new String instance by decoding a specified arrayof bytes (mostly used by JNI).

        Parameters:
        bytes - the bytes to be decoded into characters/a newString instance