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 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 newSubstringstatic 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 tracestatic 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)
-
-
-
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)
-
-