public class StringUtil
extends java.lang.Object
StringUtil
class provides utility methods for working with strings.Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.Properties |
appendProperties(java.util.Properties source,
java.util.Properties plus,
boolean override)
Appends properties specified in a given 'plus' object to a given 'source' object.
|
static int |
countWords(java.lang.String text) |
static java.lang.String |
errorStackTraceContent(java.lang.Throwable error)
Return the content of the stack trace for a given
Throwable object. |
static java.lang.String |
extractTextFromMarkup(java.lang.String mString) |
static java.lang.String |
getPlainClassName(java.lang.Class<?> aClass)
Returns a plain name (without package name) of a given Java
Class . |
static int |
indexOfIgnoreCase(java.lang.String mainStr,
java.lang.String argStr) |
static int |
indexOfIgnoreCase(java.lang.String mainStr,
java.lang.String argStr,
int fromIndex) |
static boolean |
isLowerCase(java.lang.String string) |
static boolean |
isUpperCase(java.lang.String string) |
static java.lang.String |
toRegExpReplacement(java.lang.String string)
Converts a given input string to another string that can be used as a 'replacement' string in
the
String::replaceAll(String regex, String replacement) method. |
static java.lang.String |
toRegExpString(java.lang.String string)
Converts a given input string to another string that can be used in all 'regular expression'
methods.
|
public static java.util.Properties appendProperties(java.util.Properties source, java.util.Properties plus, boolean override)
true
, the 'plus' properties will override the 'source'
properties with the same name, otherwise the 'source' properties will stay.source
- The given 'source' properties object.plus
- The given 'plus' properties object.override
- If this flag is true
, the 'plus' properties will override the 'source'
properties with the same name, otherwise the 'source' properties will stay.public static int countWords(java.lang.String text)
text
- The given string.public static java.lang.String errorStackTraceContent(java.lang.Throwable error)
Throwable
object.error
- The given Throwable
object.public static java.lang.String extractTextFromMarkup(java.lang.String mString)
mString
- The given markup string.public static java.lang.String getPlainClassName(java.lang.Class<?> aClass)
Class
.aClass
- The given Java Class
.Class
.public static boolean isLowerCase(java.lang.String string)
string
- The given string.true
, if all characters in a given string are lowercase letters,
false
otherwise.public static boolean isUpperCase(java.lang.String string)
string
- The given string.true
, if all characters in a given string are uppercase letters,
false
otherwise.public static int indexOfIgnoreCase(java.lang.String mainStr, java.lang.String argStr)
mainStr
- The given string object.argStr
- The given string argument.-1
is returned.public static int indexOfIgnoreCase(java.lang.String mainStr, java.lang.String argStr, int fromIndex)
mainStr
- The given string object.argStr
- The given string argument.fromIndex
- The index to start the search from.fromIndex
, then the
index of the first character of the first such substring is returned; if it does not
occur as a substring starting at fromIndex
or beyond, -1
is returned.public static java.lang.String toRegExpReplacement(java.lang.String string)
String::replaceAll(String regex, String replacement)
method. string
- The given input string.String::replaceAll(String regex, String replacement)
method.public static java.lang.String toRegExpString(java.lang.String string)
string
- The given input string.Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.