Package com.reportmill.base
Class StringUtils
java.lang.Object
com.reportmill.base.StringUtils
This class is a collection of convenient static String utils.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringAdds the two strings together (treats nulls as empty strings).static StringAdds the two strings together with separator (treats nulls as empty strings, ommitting sep if either is null).static StringReturns the result of deleting from the given string any occurance of the search string.static StringReturns the result of deleting from the given string any occurance of the search string (ignores case).static StringdeleteLastPathComponent(String aString) Returns the given path string minus the last part.static StringdeletePathExtension(String aString) Returns the given path string minus its extension.static doubledoubleValue(String aString) Returns an double value by parsing the given string.static doubledoubleValue(String aString, int aStart) Returns an double value by parsing the given string starting at the given index.static booleanendsWithIC(String s1, String s2) Returns whether s1 ends with s2, ignoring case.static booleanReturns whether s1 equals s2, ignoring case.static StringfirstCharLowerCase(String aString) Returns the given string with the first char demoted to lowercase.static StringfirstCharUpperCase(String aString) Returns the given string with the first char promoted to uppercase.static floatfloatValue(String aString) Returns an float value by parsing the given string.static byte[]Returns the ASCII bytes of the given string (ISO-Latin).static byte[]Returns the bytes of the given string in the requested char encoding.static StringgetISOLatinString(byte[] bytes) Returns a string from the given ASCII bytes.static StringgetISOLatinString(byte[] bytes, int offset, int length) Returns a string from the given ASCII bytes (from offset to offset+length).static intReturns the index of search string s2 in given string s1, ignores case.static intReturns the index of search string s2 in given string s1, ignores case and starts at start char index.static intReturns an int value by parsing the given string.static StringAllows you to take an array of strings and concatenate them together with a separatorstatic StringAllows you to take an array of strings and concatenate them together with a separatorstatic StringlastPathComponent(String aString) Returns the last part of a path string.static StringlastPathComponentNoExt(String aString) Returns the file name of the given path string (minus parent directory and extension).static intReturns the length of given string (supports null).static StringString promotion - returns either the given string or empty string (if given string is null).static StringString demotion - returns either the given string or null (if given string length is zero).static RMRangenextKeyRangeAfterIndex(String aString, int anIndex, RMRange aRange) Returns the range of the next occurance of @delimited@ text.static StringReturns the first non-null string of the two given strings (or null).static StringpathExtension(String aString) Returns the extension of the given string (or null if no extension).static StringpathExtension2(String aString) Returns the extension of the given string (or the string if no extension).static StringReturns the result of replacing in the given string the char range with the with-string.static StringReturns the result of replacing in the given string any occurance of the search string with the replace-char.static StringReturns the result of replacing in the given string any occurance of the search string with the replace-string.static StringReturns the result of replacing in given string any occurance of search string with replace-string (ignore case).static ListReturns a list of parts of given string separated by the given delimiter.static ListReturns a list of parts of given string separated by the given delimiter, with option to strip leading space.static booleanstartsWithIC(String s1, String s2) Returns whether s1 starts with s2, ignoring case.static StringtoString(float aValue) Returns a string representation of the given float to (at most) 3 significant digits.static StringtoString(float aValue, int significantDigits) Returns a string representation of the given float to the given number of significant digits.static StringReturns string wrapped to approximate width (quick and dirty line wrapping for use in things like option panes).
- 
Constructor Details- 
StringUtilspublic StringUtils()
 
- 
- 
Method Details- 
lengthReturns the length of given string (supports null).
- 
addAdds the two strings together (treats nulls as empty strings).
- 
addAdds the two strings together with separator (treats nulls as empty strings, ommitting sep if either is null).
- 
minString demotion - returns either the given string or null (if given string length is zero).
- 
maxString promotion - returns either the given string or empty string (if given string is null).
- 
orReturns the first non-null string of the two given strings (or null).
- 
toStringReturns a string representation of the given float to (at most) 3 significant digits.
- 
toStringReturns a string representation of the given float to the given number of significant digits.
- 
nextKeyRangeAfterIndexReturns the range of the next occurance of @delimited@ text.
- 
pathExtensionReturns the extension of the given string (or null if no extension).
- 
pathExtension2Returns the extension of the given string (or the string if no extension).
- 
deletePathExtensionReturns the given path string minus its extension.
- 
lastPathComponentReturns the last part of a path string.
- 
deleteLastPathComponentReturns the given path string minus the last part.
- 
lastPathComponentNoExtReturns the file name of the given path string (minus parent directory and extension).
- 
deleteReturns the result of deleting from the given string any occurance of the search string.
- 
deleteICReturns the result of deleting from the given string any occurance of the search string (ignores case).
- 
replaceReturns the result of replacing in the given string the char range with the with-string.
- 
replaceReturns the result of replacing in the given string any occurance of the search string with the replace-char.
- 
replaceReturns the result of replacing in the given string any occurance of the search string with the replace-string.
- 
replaceICReturns the result of replacing in given string any occurance of search string with replace-string (ignore case).
- 
separateReturns a list of parts of given string separated by the given delimiter.
- 
separateReturns a list of parts of given string separated by the given delimiter, with option to strip leading space.
- 
intValueReturns an int value by parsing the given string.
- 
floatValueReturns an float value by parsing the given string.
- 
doubleValueReturns an double value by parsing the given string.
- 
doubleValueReturns an double value by parsing the given string starting at the given index.
- 
getBytesReturns the ASCII bytes of the given string (ISO-Latin).
- 
getBytesReturns the bytes of the given string in the requested char encoding.
- 
getISOLatinStringReturns a string from the given ASCII bytes.
- 
getISOLatinStringReturns a string from the given ASCII bytes (from offset to offset+length).
- 
indexOfICReturns the index of search string s2 in given string s1, ignores case.
- 
indexOfICReturns the index of search string s2 in given string s1, ignores case and starts at start char index.
- 
equalsICReturns whether s1 equals s2, ignoring case.
- 
endsWithICReturns whether s1 ends with s2, ignoring case.
- 
startsWithICReturns whether s1 starts with s2, ignoring case.
- 
firstCharUpperCaseReturns the given string with the first char promoted to uppercase.
- 
firstCharLowerCaseReturns the given string with the first char demoted to lowercase.
- 
wrapReturns string wrapped to approximate width (quick and dirty line wrapping for use in things like option panes).
- 
joinAllows you to take an array of strings and concatenate them together with a separator- Parameters:
- parts- an array of Strings
- separator- a string to place between elements
- Returns:
 
- 
joinAllows you to take an array of strings and concatenate them together with a separator- Parameters:
- parts- an array to be conacatenated
- separator- a string to place between elements
- numElements- how many to include in the result
- Returns:
 
 
-