public class StringUtil
extends java.lang.Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.List |
blankStringList(int size)
Returns a List of empty Strings.
|
static java.lang.String |
capitalize(java.lang.String word) |
static java.lang.String |
classNameWithoutPackageQualifiers(java.lang.String className) |
static java.lang.String |
classNameWithoutQualifiers(java.lang.String className) |
static java.lang.String |
friendlyName(java.lang.Class c) |
static java.util.List |
fromCommaDelimitedString(java.lang.String s)
Converts the comma-delimited string into a List of trimmed strings.
|
static java.lang.String |
head(java.lang.String s,
int lines) |
static java.lang.String |
ies(int n)
Warning: hinders internationalization
|
static java.lang.String |
insertSpaces(java.lang.String s) |
static boolean |
isEmpty(java.lang.String value) |
static boolean |
isNumber(java.lang.String token) |
static java.lang.String |
limitLength(java.lang.String s,
int maxLength) |
static java.lang.String |
repeat(char c,
int n) |
static void |
replace(java.lang.StringBuffer orig,
java.lang.String o,
java.lang.String n,
boolean all)
Replaces all instances of the String o with the String n in the
StringBuffer orig if all is true, or only the first instance if all is
false.
|
static java.lang.String |
replace(java.lang.String original,
java.lang.String oldSubstring,
java.lang.String newSubstring,
boolean all)
Returns original with occurrences of oldSubstring replaced by
newSubstring.
|
static java.lang.String |
replaceAll(java.lang.String original,
java.lang.String oldSubstring,
java.lang.String newSubstring)
Returns original with all occurrences of oldSubstring replaced by
newSubstring
|
static java.lang.String |
s(int n)
Warning: hinders internationalization
|
static java.lang.String |
split(java.lang.String s,
int n)
Line-wraps s by inserting a newline instead of the first space after the nth
column.
|
static java.lang.String |
stackTrace(java.lang.Throwable t)
Returns an throwable's stack trace
|
static java.lang.String |
substitute(java.lang.String string,
java.lang.Object[] substitutions) |
static java.lang.String |
toCommaDelimitedString(java.util.Collection c)
Returns the elements of c separated by commas.
|
static java.lang.String |
toDelimitedString(java.util.Collection c,
java.lang.String delimiter) |
static java.lang.String |
toFriendlyName(java.lang.String className) |
static java.lang.String |
toFriendlyName(java.lang.String className,
java.lang.String substringToRemove) |
static java.lang.String |
toTimeString(long milliseconds) |
static java.lang.String |
uncapitalize(java.lang.String word) |
public static java.lang.String s(int n)
public static java.lang.String ies(int n)
public static java.lang.String substitute(java.lang.String string, java.lang.Object[] substitutions)
public static java.lang.String classNameWithoutQualifiers(java.lang.String className)
public static java.lang.String classNameWithoutPackageQualifiers(java.lang.String className)
public static java.lang.String repeat(char c, int n)
public static java.lang.String split(java.lang.String s, int n)
public static java.lang.String capitalize(java.lang.String word)
public static java.lang.String uncapitalize(java.lang.String word)
public static java.util.List fromCommaDelimitedString(java.lang.String s)
s
- a String with comma-delimited valuespublic static java.util.List blankStringList(int size)
size
- the size of the List to createpublic static java.lang.String toFriendlyName(java.lang.String className)
public static java.lang.String friendlyName(java.lang.Class c)
public static java.lang.String toFriendlyName(java.lang.String className, java.lang.String substringToRemove)
public static java.lang.String insertSpaces(java.lang.String s)
public static java.lang.String toCommaDelimitedString(java.util.Collection c)
c
- a Collection of objects to convert to Strings and delimit by commaspublic static java.lang.String replaceAll(java.lang.String original, java.lang.String oldSubstring, java.lang.String newSubstring)
public static java.lang.String replace(java.lang.String original, java.lang.String oldSubstring, java.lang.String newSubstring, boolean all)
public static void replace(java.lang.StringBuffer orig, java.lang.String o, java.lang.String n, boolean all)
public static java.lang.String stackTrace(java.lang.Throwable t)
public static java.lang.String head(java.lang.String s, int lines)
public static java.lang.String limitLength(java.lang.String s, int maxLength)
public static boolean isNumber(java.lang.String token)
public static java.lang.String toDelimitedString(java.util.Collection c, java.lang.String delimiter)
public static java.lang.String toTimeString(long milliseconds)
public static boolean isEmpty(java.lang.String value)