java.lang.Object
org.mbari.jcommons.util.StringUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsOrderedChars(String chars, String text) static final StringReturn the token specified by position in a string using white space delimiters (\t\r\n\f and space).static final StringReturn the token specified by position in a string using the specified delimiter.static booleanisBlank(CharSequence cs) static final String[]Useful method for ordering a 1-D array based on an array of indicesstatic final StringRepeat a string.
-
Method Details
-
getToken
Return the token specified by position in a string using the specified delimiter. For example,
String str = "Mary;had;a;little;lamb."; String little = StringUtilities.getToken(str, 4, ";"); // little = "little"- Parameters:
str- The string to parsetokenNumber- The (ones-based) index of the token to be returneddelim- The token delimiter- Returns:
- String From position specifed
-
getToken
Return the token specified by position in a string using white space delimiters (\t\r\n\f and space). For example,
String str = "Mary had a little lamb."; String little = StringUtilities.getToken(str, 4); // little = "little"- Parameters:
str- The string to parsetokenNumber- The (ones-based) index of the token to be returned- Returns:
- String from position specified
-
order
Useful method for ordering a 1-D array based on an array of indices- Parameters:
values- A 1-D array of data to be sorted based on an array of indicesorder- A 1-D array of indices specifying the ordering of the data.
-
repeat
Repeat a string. Analagous to pythons ability to do "AB" * 2 = "ABAB". For example: StringUtilities.repeat("AB", 2) = "ABAB"- Parameters:
s- The string to repeati- The number of times to repeat the string
-
isBlank
-
containsOrderedChars
-