Package org.locationtech.jts.jump.util
Class StringUtil
- java.lang.Object
-
- org.locationtech.jts.jump.util.StringUtil
-
public class StringUtil extends Object
Useful String-related utilities.
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ListblankStringList(int size)Returns a List of empty Strings.static Stringcapitalize(String word)static StringclassNameWithoutPackageQualifiers(String className)static StringclassNameWithoutQualifiers(String className)static StringfriendlyName(Class c)static ListfromCommaDelimitedString(String s)Converts the comma-delimited string into a List of trimmed strings.static Stringhead(String s, int lines)static Stringies(int n)static StringinsertSpaces(String s)static booleanisNumber(String token)static StringlimitLength(String s, int maxLength)static Stringrepeat(char c, int n)static voidreplace(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 Stringreplace(String original, String oldSubstring, String newSubstring, boolean all)Returns original with occurrences of oldSubstring replaced by newSubstring.static StringreplaceAll(String original, String oldSubstring, String newSubstring)Returns original with all occurrences of oldSubstring replaced by newSubstringstatic Strings(int n)static Stringsplit(String s, int n)Line-wraps s by inserting a newline instead of the first space after the nth column.static StringstackTrace(Throwable t)Returns an throwable's stack tracestatic StringtoCommaDelimitedString(Collection c)Returns the elements of c separated by commas.static StringtoDelimitedString(Collection c, String delimiter)static StringtoFriendlyName(String className)static StringtoFriendlyName(String className, String substringToRemove)static StringtoTimeString(long milliseconds)static Stringuncapitalize(String word)
-
-
-
Method Detail
-
s
public static String s(int n)
-
ies
public static String ies(int n)
-
classNameWithoutPackageQualifiers
public static String classNameWithoutPackageQualifiers(String className)
-
repeat
public static String repeat(char c, int n)
-
split
public static String split(String s, int n)
Line-wraps s by inserting a newline instead of the first space after the nth column. Word-wraps.
-
fromCommaDelimitedString
public static List fromCommaDelimitedString(String s)
Converts the comma-delimited string into a List of trimmed strings.- Parameters:
s- a String with comma-delimited values- Returns:
- a List of the Strings that were delimited by commas
-
blankStringList
public static List blankStringList(int size)
Returns a List of empty Strings.- Parameters:
size- the size of the List to create- Returns:
- a List of blank Strings
-
toCommaDelimitedString
public static String toCommaDelimitedString(Collection c)
Returns the elements of c separated by commas. If c is empty, an empty String will be returned.- Parameters:
c- a Collection of objects to convert to Strings and delimit by commas- Returns:
- a String containing c's elements, delimited by commas
-
replaceAll
public static String replaceAll(String original, String oldSubstring, String newSubstring)
Returns original with all occurrences of oldSubstring replaced by newSubstring
-
replace
public static String replace(String original, String oldSubstring, String newSubstring, boolean all)
Returns original with occurrences of oldSubstring replaced by newSubstring. Set all to true to replace all occurrences, or false to replace the first occurrence only.
-
replace
public 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. Posted by Steve Chapelon UseNet
-
isNumber
public static boolean isNumber(String token)
-
toDelimitedString
public static String toDelimitedString(Collection c, String delimiter)
-
toTimeString
public static String toTimeString(long milliseconds)
-
-