Package org.restlet.engine.util
Class StringUtils
java.lang.Object
org.restlet.engine.util.StringUtils
String manipulation utilities.
- Author:
- Jerome Louvel
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringfirstLower(String string) Returns the string with the first character capitalized.static StringfirstUpper(String string) Returns the string with the first character capitalized.static byte[]getAsciiBytes(String string) Encodes the given String into a sequence of bytes using the Ascii character set.static byte[]getLatin1Bytes(String string) Encodes the given String into a sequence of bytes using the Latin1 character set.static StringhtmlEscape(String str) Returns the givenStringaccording to the HTML 4.0 encoding rules.static StringhtmlUnescape(String str) Returns the givenStringdecoded according to the HTML 4.0 decoding rules.static booleanisNullOrEmpty(String string) Returnstrueif the given string is null or is the empty string.
-
Method Details
-
firstLower
Returns the string with the first character capitalized.- Parameters:
string- a string reference to check- Returns:
- the string with the first character capitalized.
-
firstUpper
Returns the string with the first character capitalized.- Parameters:
string- a string reference to check- Returns:
- the string with the first character capitalized.
-
getAsciiBytes
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
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
Returns the givenStringaccording to the HTML 4.0 encoding rules. -
htmlUnescape
Returns the givenStringdecoded according to the HTML 4.0 decoding rules. -
isNullOrEmpty
Returnstrueif the given string is null or is the empty string. Consider normalizing your string references with#nullToEmpty. If you do, you can useString.isEmpty()instead of this method, and you won't need special null-safe forms of methods likeString.toUpperCase(java.util.Locale)either.- Parameters:
string- a string reference to check- Returns:
trueif the string is null or is the empty string
-