Package rocks.xmpp.util
Class Strings
- java.lang.Object
-
- rocks.xmpp.util.Strings
-
public final class Strings extends Object
Utility class for Strings.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
compareUnsignedBytes(String s1, String s2, Charset charset)
Compares two string by comparing their byte arrays.static boolean
isNullOrEmpty(String str)
static String
toDash(String str)
Converts a string from camel case to a string with dashes.static String
toUnderscore(String str)
Converts a string from camel case to a string with underscores.
-
-
-
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.
-
-