Class Strings


  • public final class Strings
    extends Object
    Utility class for Strings.
    • Method Detail

      • isNullOrEmpty

        public static boolean isNullOrEmpty​(String str)
      • toDash

        public static String toDash​(String str)
        Converts a string from camel case to a string with dashes.

        Each upper case character (except the first one) followed by a lower case character is converted to a lower case character preceded by a dash, e.g. "CamelCase" is converted to "camel-case".

        Parameters:
        str - The string.
        Returns:
        The string with dashes.
      • toUnderscore

        public static String toUnderscore​(String str)
        Converts a string from camel case to a string with underscores.

        Each upper case character (except the first one) followed by a lower case character is converted to a lower case character preceded by an underscore, e.g. "CamelCase" is converted to "camel_case".

        Parameters:
        str - The string.
        Returns:
        The string with dashes.
      • compareUnsignedBytes

        public static int compareUnsignedBytes​(String s1,
                                               String s2,
                                               Charset charset)
        Compares two string by comparing their byte arrays. The "i;octet" collation is described in 9.3.1. Octet Collation Description.
        Parameters:
        s1 - The first byte array.
        s2 - The second byte array.
        charset - The charset.
        Returns:
        The comparison result.