Class StringUtils

java.lang.Object
org.restlet.engine.util.StringUtils

public class StringUtils extends Object
String manipulation utilities.
Author:
Jerome Louvel
  • Method Details

    • firstLower

      public static String firstLower(String string)
      Returns the string with the first character capitalized.
      Parameters:
      string - a string reference to check
      Returns:
      the string with the first character capitalized.
    • firstUpper

      public static String firstUpper(String string)
      Returns the string with the first character capitalized.
      Parameters:
      string - a string reference to check
      Returns:
      the string with the first character capitalized.
    • getAsciiBytes

      public static byte[] getAsciiBytes(String string)
      Encodes the given String into a sequence of bytes using the Ascii character set.
      Parameters:
      string - The string to encode.
      Returns:
      The String encoded with the Ascii character set as an array of bytes.
    • getLatin1Bytes

      public static byte[] getLatin1Bytes(String string)
      Encodes the given String into a sequence of bytes using the Latin1 character set.
      Parameters:
      string - The string to encode.
      Returns:
      The String encoded with the Latin1 character set as an array of bytes.
    • htmlEscape

      public static String htmlEscape(String str)
      Returns the given String according to the HTML 4.0 encoding rules.
      Parameters:
      str - The String to encode.
      Returns:
      The converted String according to the HTML 4.0 encoding rules.
    • htmlUnescape

      public static String htmlUnescape(String str)
      Returns the given String decoded according to the HTML 4.0 decoding rules.
      Parameters:
      str - The String to decode.
      Returns:
      The given String decoded according to the HTML 4.0 decoding rules.
    • isNullOrEmpty

      public static boolean isNullOrEmpty(String string)
      Returns true if the given string is null or is the empty string. Consider normalizing your string references with #nullToEmpty. If you do, you can use String.isEmpty() instead of this method, and you won't need special null-safe forms of methods like String.toUpperCase(java.util.Locale) either.
      Parameters:
      string - a string reference to check
      Returns:
      true if the string is null or is the empty string