public class StringUtil
extends java.lang.Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
extractWord(java.lang.String string,
int wordNumber)
Attempts to find the N'th word in the given string.
|
static java.lang.String |
mapReplace(java.lang.String source,
java.util.Map<java.lang.String,java.lang.String> map)
Convenience method calling
mapReplace(String, Map, String, String) without prefix and suffix |
static java.lang.String |
mapReplace(java.lang.String source,
java.util.Map<java.lang.String,java.lang.String> map,
java.lang.String keyPrefix,
java.lang.String keySuffix)
Returns a modified version of the given source string.
|
static boolean |
spacelessCaseInsensitiveCompare(java.lang.String str1,
java.lang.String str2)
Compares the two given strings while ignoring case and white spaces.
|
static int |
wordCount(java.lang.String string)
Counts the words in the given string assuming the words are split by a
space character
|
static int |
wordCount(java.lang.String string,
java.lang.String delimiter)
Counts the words in the given string using the given word delimiter
|
public static java.lang.String mapReplace(java.lang.String source, java.util.Map<java.lang.String,java.lang.String> map, java.lang.String keyPrefix, java.lang.String keySuffix)
source
- the source stringmap
- the key/value mapkeyPrefix
- appended to the beginning of the key before the replace
operation. Example: key='node-name', prefix='%' => replacing
occurrences of '%node-name'keySuffix
- appended to the ending of the key before the replace
operation. Example: key='node-name', prefix='%' => replacing
occurrences of 'node-name%'public static java.lang.String mapReplace(java.lang.String source, java.util.Map<java.lang.String,java.lang.String> map)
mapReplace(String, Map, String, String)
without prefix and suffixpublic static boolean spacelessCaseInsensitiveCompare(java.lang.String str1, java.lang.String str2)
public static int wordCount(java.lang.String string, java.lang.String delimiter)
public static int wordCount(java.lang.String string)
public static java.lang.String extractWord(java.lang.String string, int wordNumber)