public class StringUtil extends Object
| Constructor and Description |
|---|
StringUtil() |
| Modifier and Type | Method and Description |
|---|---|
static List |
blankStringList(int size)
Returns a List of empty Strings.
|
static String |
capitalize(String word) |
static String |
classNameWithoutPackageQualifiers(String className) |
static String |
classNameWithoutQualifiers(String className) |
static String |
friendlyName(Class c) |
static List |
fromCommaDelimitedString(String s)
Converts the comma-delimited string into a List of trimmed strings.
|
static String |
head(String s,
int lines) |
static String |
ies(int n) |
static String |
insertSpaces(String s) |
static boolean |
isNumber(String token) |
static String |
limitLength(String s,
int maxLength) |
static String |
repeat(char c,
int n) |
static void |
replace(StringBuffer orig,
String o,
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 String |
replace(String original,
String oldSubstring,
String newSubstring,
boolean all)
Returns original with occurrences of oldSubstring replaced by
newSubstring.
|
static String |
replaceAll(String original,
String oldSubstring,
String newSubstring)
Returns original with all occurrences of oldSubstring replaced by
newSubstring
|
static String |
s(int n) |
static String |
split(String s,
int n)
Line-wraps s by inserting a newline instead of the first space after the nth
column.
|
static String |
stackTrace(Throwable t)
Returns an throwable's stack trace
|
static String |
toCommaDelimitedString(Collection c)
Returns the elements of c separated by commas.
|
static String |
toDelimitedString(Collection c,
String delimiter) |
static String |
toFriendlyName(String className) |
static String |
toFriendlyName(String className,
String substringToRemove) |
static String |
toTimeString(long milliseconds) |
static String |
uncapitalize(String word) |
public static String s(int n)
public static String ies(int n)
public static String classNameWithoutPackageQualifiers(String className)
public static String repeat(char c, int n)
public static String split(String s, int n)
public static List fromCommaDelimitedString(String s)
s - a String with comma-delimited valuespublic static List blankStringList(int size)
size - the size of the List to createpublic static String toCommaDelimitedString(Collection c)
c - a Collection of objects to convert to Strings and delimit by commaspublic static String replaceAll(String original, String oldSubstring, String newSubstring)
public static String replace(String original, String oldSubstring, String newSubstring, boolean all)
public static void replace(StringBuffer orig, String o, String n, boolean all)
public static boolean isNumber(String token)
public static String toDelimitedString(Collection c, String delimiter)
public static String toTimeString(long milliseconds)
Copyright © 2015. All rights reserved.