public class StringUtil extends Object
StringUtil.| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
capitalize(String s)
Returns a version of the supplied string with the first letter capitalized.
|
static String |
escapeAttribute(String value)
Escapes user or deployment values that we need to put into an html attribute.
|
static String |
getOr(String value,
String defval)
Returns the string if it is non-blank (see
isBlank(java.lang.String)), the default value otherwise. |
static String |
hexlate(byte[] bytes)
Generates a string from the supplied bytes that is the HEX encoded representation of those
bytes.
|
static String |
hexlate(byte[] bytes,
int count)
Generates a string from the supplied bytes that is the HEX encoded representation of those
bytes.
|
static boolean |
isBlank(String text)
Returns true if the supplied string is null, zero length, or contains only whitespace.
|
static String |
join(Iterable<?> items)
Joins the given sequence of strings with a command and space between each consecutive pair.
|
static String |
join(Iterable<?> items,
String sep)
Joins the given sequence of strings, which the given separator string between each
consecutive pair.
|
static String |
sanitizeAttribute(String value)
Nukes special attribute characters.
|
static String |
truncate(String str,
int limit)
Truncates the string so it has length less than or equal to the given limit.
|
static String |
truncate(String str,
int limit,
String appendage)
Truncates the string so it has length less than or equal to the given limit.
|
static byte[] |
unhexlate(String hex)
Turn a hexlated String back into a byte array.
|
public static String hexlate(byte[] bytes, int count)
null or empty byte array.bytes - the bytes for which we want a string representation.count - the number of bytes to stop at (which will be coerced into being <= the length
of the array).public static String hexlate(byte[] bytes)
public static byte[] unhexlate(String hex)
public static boolean isBlank(String text)
public static String getOr(String value, String defval)
isBlank(java.lang.String)), the default value otherwise.public static String escapeAttribute(String value)
public static String sanitizeAttribute(String value)
public static String truncate(String str, int limit)
public static String truncate(String str, int limit, String appendage)
public static String capitalize(String s)
public static String join(Iterable<?> items)
Copyright © 2013. All Rights Reserved.