public class BaseSimpleStringUtil
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
AOP_PROPERTIES_PATH |
static java.lang.String |
BLANK |
static java.lang.String |
COMMA |
static java.lang.String |
EMPTY
The empty String
"". |
static int |
INDEX_NOT_FOUND
Represents a failed index search.
|
protected static org.slf4j.Logger |
logger |
static int |
SPLIT_ALL
A constant passed to the
split()methods indicating that
all occurrences of a pattern should be used to split a string. |
| 构造器和说明 |
|---|
BaseSimpleStringUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.lang.String[] |
addStringToArray(java.lang.String[] array,
java.lang.String str)
Append the given String to the given String array, returning a new array
consisting of the input array contents plus the given String.
|
static java.lang.String |
applyRelativePath(java.lang.String path,
java.lang.String relativePath)
Apply the given relative path to the given path,
assuming standard Java folder separation (i.e. "/" separators);
|
static java.lang.String |
arrayToCommaDelimitedString(java.lang.Object[] arr)
Convenience method to return a String array as a CSV String.
|
static java.lang.String |
arrayToDelimitedString(java.lang.Object[] arr,
java.lang.String delim)
Convenience method to return a String array as a delimited (e.g.
|
static java.util.Enumeration |
arryToenum(java.lang.Object[] values) |
static java.lang.String |
ascii2native(java.lang.String s) |
static java.lang.String |
buildStringMessage(java.util.List messages)
构建消息日志
|
static java.lang.String |
cleanPath(java.lang.String path)
Normalize the path by suppressing sequences like "path/.." and
inner simple dots.
|
static java.lang.String |
collectionToCommaDelimitedString(java.util.Collection coll)
Convenience method to return a Collection as a CSV String.
|
static java.lang.String |
collectionToDelimitedString(java.util.Collection coll,
java.lang.String delim)
Convenience method to return a Collection as a delimited (e.g.
|
static java.lang.String |
collectionToDelimitedString(java.util.Collection coll,
java.lang.String delim,
java.lang.String prefix,
java.lang.String suffix)
Convenience method to return a Collection as a delimited (e.g.
|
static java.lang.String[] |
commaDelimitedListToStringArray(java.lang.String str)
Convert a CSV list into an array of Strings.
|
static boolean |
containKey(java.lang.String[] values,
java.lang.String key) |
static java.util.Map<java.lang.String,java.util.Locale> |
converLocales(java.lang.String locales) |
static int |
countOccurrencesOf(java.lang.String str,
java.lang.String sub)
Count the occurrences of the substring in string s.
|
static java.lang.String[] |
dateArrayTOStringArray(java.util.Date[] dates)
将日期数组转换成字符串数组
|
static java.lang.String |
deleteAny(java.lang.String inString,
java.lang.String charsToDelete)
Delete any character in a given String.
|
static java.lang.String[] |
delimitedListToStringArray(java.lang.String str,
java.lang.String delimiter)
Take a String which is a delimited list and convert it to a String array.
|
static java.lang.String[] |
delimitedListToStringArray(java.lang.String str,
java.lang.String delimiter,
java.lang.String charsToDelete)
Take a String which is a delimited list and convert it to a String array.
|
static java.lang.String |
encode(java.lang.String s)
Translates a string into
application/x-www-form-urlencoded
format using a specific encoding scheme. |
static java.lang.String |
encode(java.lang.String s,
java.lang.String enc)
Translates a string into
application/x-www-form-urlencoded
format using a specific encoding scheme. |
static java.lang.String |
exceptionToString(java.lang.Throwable exception) |
static java.lang.String |
formatBRException(java.lang.Throwable exception) |
static java.lang.String |
formatException(java.lang.Throwable exception) |
static java.lang.String |
formatTimeToString(long mss) |
static java.util.Map<java.lang.String,java.util.Locale> |
getAllLocales() |
static boolean |
getBoolean(java.lang.String value,
boolean nullReplace) |
static byte[] |
getBytesUsAscii(java.lang.String string)
Encodes the given string into a sequence of bytes using the US-ASCII charset, storing the result into a new byte
array.
|
static byte[] |
getBytesUtf16(java.lang.String string)
Encodes the given string into a sequence of bytes using the UTF-16 charset, storing the result into a new byte
array.
|
static byte[] |
getBytesUtf16Be(java.lang.String string)
Encodes the given string into a sequence of bytes using the UTF-16BE charset, storing the result into a new byte
array.
|
static byte[] |
getBytesUtf16Le(java.lang.String string)
Encodes the given string into a sequence of bytes using the UTF-16LE charset, storing the result into a new byte
array.
|
static byte[] |
getBytesUtf8(java.lang.String string)
Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte
array.
|
static java.lang.String |
getFilename(java.lang.String path)
Extract the filename from the given path,
e.g.
|
static java.lang.String |
getFileName(java.lang.String path)
获取文件名称
|
static java.lang.String |
getFileName(java.lang.String prefix,
java.lang.String extension) |
static java.lang.String |
getFilenameExtension(java.lang.String path)
Extract the filename extension from the given path,
e.g.
|
static java.lang.String |
getFormatDate(java.util.Date date,
java.lang.String formate) |
static java.lang.String |
getHostIP()
获取服务器IP和名称
|
static java.io.InputStream |
getInputStream(java.lang.String resourcefile,
java.lang.Class clazz) |
static int |
getInt(java.lang.String value,
int defaultValue) |
static java.util.Locale |
getLocale(java.lang.String locale) |
static java.lang.String |
getNormalPath(java.lang.String parent,
java.lang.String file) |
static java.lang.String |
getOS()
determine the OS name
|
static java.lang.String |
getPath(java.lang.String contextPath,
java.lang.String path) |
static java.util.Properties |
getProperties(java.lang.String resourcefile,
java.lang.Class clazz) |
static void |
getRealPath(java.lang.StringBuilder builder,
java.lang.String contextPath,
java.lang.String path) |
static void |
getRealPath(java.lang.StringBuilder builder,
java.lang.String contextPath,
java.lang.String path,
boolean usebase) |
static java.lang.String |
getRealPath(java.lang.String contextPath,
java.lang.String path) |
static java.lang.String |
getRealPath(java.lang.String contextPath,
java.lang.String path,
boolean usebase) |
static java.lang.String |
getUUID() |
static boolean |
hasLength(java.lang.CharSequence str)
Check that the given CharSequence is neither
null nor of length 0. |
static boolean |
hasText(java.lang.CharSequence str)
Check whether the given CharSequence has actual text.
|
static boolean |
hasText(java.lang.String str) |
static boolean |
isEmpty(java.util.Collection cl) |
static boolean |
isEmpty(java.lang.Object obj) |
static boolean |
isEmpty(java.lang.String value) |
static boolean |
isHttpUrl(java.lang.String path) |
static boolean |
isJavascript(java.lang.String nodeLink)
判断链接是否是javascript函数
|
static boolean |
isLinux() |
static boolean |
isNotEmpty(java.util.Collection cl) |
static boolean |
isNotEmpty(java.lang.Object obj) |
static boolean |
isNotEmpty(java.lang.String value) |
static boolean |
isOSX() |
static boolean |
isWindows() |
static java.util.Date[] |
longArrayTODateArray(long[] dates_s,
java.text.DateFormat dateformat)
将字符串数组转换成日期数组
Date[] 字符串数组
|
static java.sql.Date[] |
longArrayTOSQLDateArray(long[] dates_s,
java.text.DateFormat dateformat)
将字符串数组转换成日期数组
Date[] 字符串数组
|
static java.sql.Timestamp[] |
longArrayTOTimestampArray(long[] dates_s,
java.text.DateFormat dateformat)
将字符串数组转换成日期数组
Date[] 字符串数组
|
static java.lang.String |
native2ascii(java.lang.String s) |
static java.lang.String |
newStringUtf8(byte[] bytes)
Constructs a new
String by decoding the specified array of bytes using the UTF-8 charset. |
static java.util.Locale |
parseLocaleString(java.lang.String localeString)
Parse the given
localeString into a Locale. |
static java.util.TimeZone |
parseTimeZoneString(java.lang.String timeZoneString)
Parse the given
timeZoneString value into a TimeZone. |
static boolean |
pathEquals(java.lang.String path1,
java.lang.String path2)
Compare two paths after normalization of them.
|
static java.lang.String[] |
removeDuplicateStrings(java.lang.String[] array)
Remove duplicate Strings from the given array.
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement)
Replaces all occurrences of a String within another String.
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement,
int max)
Replaces a String with another String inside a larger String,
for the first
max values of the search String. |
static java.lang.String |
replaceChars(java.lang.String str,
java.lang.String searchChars,
java.lang.String replaceChars) |
static java.lang.String |
replaceNull(java.lang.String resource) |
static java.lang.String |
replaceNull(java.lang.String value,
java.lang.String nullReplace) |
java.util.List |
splitString(java.lang.String src,
int size) |
java.lang.String |
splitString(java.lang.String src,
int offset,
int size) |
static boolean |
startsWithIgnoreCase(java.lang.String str,
java.lang.String prefix)
Test if the given String starts with the specified prefix,
ignoring upper/lower case.
|
static java.util.Date[] |
stringArrayTODateArray(java.lang.String[] dates_s,
java.text.DateFormat dateformat)
将字符串数组转换成日期数组
Date[] 字符串数组
|
static java.sql.Date[] |
stringArrayTOSQLDateArray(java.lang.String[] dates_s,
java.text.DateFormat dateformat)
将字符串数组转换成日期数组
Date[] 字符串数组
|
static java.sql.Timestamp[] |
stringArrayTOTimestampArray(java.lang.String[] dates_s,
java.text.DateFormat dateformat)
将字符串数组转换成日期数组
Date[] 字符串数组
|
static java.util.Date |
stringToDate(java.lang.String date) |
static java.util.Date |
stringToDate(java.lang.String date,
java.lang.String format_) |
static java.lang.String |
stripFilenameExtension(java.lang.String path)
Strip the filename extension from the given path,
e.g.
|
static java.lang.String |
toGB2312(java.lang.String inpara) |
static java.lang.Integer[] |
toIntArray(java.util.Collection<java.lang.Integer> collection)
Copy the given Collection into a String array.
|
static java.lang.String[] |
tokenizeToStringArray(java.lang.String str,
java.lang.String delimiters)
Tokenize the given String into a String array via a StringTokenizer.
|
static java.lang.String[] |
tokenizeToStringArray(java.lang.String str,
java.lang.String delimiters,
boolean trimTokens,
boolean ignoreEmptyTokens)
Tokenize the given String into a String array via a StringTokenizer.
|
static java.lang.String |
toLanguageTag(java.util.Locale locale)
Determine the RFC 3066 compliant language tag,
as used for the HTTP "Accept-Language" header.
|
static java.lang.String |
tostring(java.lang.Object data) |
static void |
tostring(java.lang.StringBuilder ret,
java.lang.Object data) |
static java.lang.String[] |
toStringArray(java.util.Collection collection)
Copy the given Collection into a String array.
|
static java.lang.String[] |
toStringArray(java.util.Enumeration enumeration)
Copy the given Enumeration into a String array.
|
static java.lang.String |
toUTF(java.lang.String inpara) |
static java.lang.String |
trimAllWhitespace(java.lang.String str)
Trim all whitespace from the given String:
leading, trailing, and inbetween characters.
|
static java.lang.String[] |
trimArrayElements(java.lang.String[] array)
Trim the elements of the given String array,
calling
String.trim() on each of them. |
static java.lang.String |
trimLeadingCharacter(java.lang.String str,
char leadingCharacter)
Trim all occurences of the supplied leading character from the given String.
|
static java.lang.String |
trimLeadingWhitespace(java.lang.String str)
Trim leading whitespace from the given String.
|
static java.lang.String |
trimTrailingCharacter(java.lang.String str,
char trailingCharacter)
Trim all occurences of the supplied trailing character from the given String.
|
static java.lang.String |
trimTrailingWhitespace(java.lang.String str)
Trim trailing whitespace from the given String.
|
static java.lang.String |
urlencode(java.lang.String value,
java.lang.String charset)
对value采用charset进行URLEncode编码,编码的次数为1
|
static java.lang.String |
urlencode(java.lang.String value,
java.lang.String charset,
int encodecount)
对value采用charset进行URLEncode编码,编码的次数根据encoudtimes指定
|
protected static final org.slf4j.Logger logger
public static final java.lang.String COMMA
public static final java.lang.String BLANK
public static final int SPLIT_ALL
split()methods indicating that
all occurrences of a pattern should be used to split a string.public static final int INDEX_NOT_FOUND
public static final java.lang.String EMPTY
"".public static final java.lang.String AOP_PROPERTIES_PATH
public static java.lang.String getPath(java.lang.String contextPath,
java.lang.String path)
public static java.lang.String getHostIP()
public static java.util.TimeZone parseTimeZoneString(java.lang.String timeZoneString)
timeZoneString value into a TimeZone.timeZoneString - the time zone String, following TimeZone.getTimeZone(String)
but throwing IllegalArgumentException in case of an invalid time zone specificationTimeZone instancejava.lang.IllegalArgumentException - in case of an invalid time zone specificationpublic static java.lang.String getRealPath(java.lang.String contextPath,
java.lang.String path)
public static void getRealPath(java.lang.StringBuilder builder,
java.lang.String contextPath,
java.lang.String path)
public static boolean isHttpUrl(java.lang.String path)
public static java.lang.String getUUID()
public static java.lang.String getRealPath(java.lang.String contextPath,
java.lang.String path,
boolean usebase)
public static void getRealPath(java.lang.StringBuilder builder,
java.lang.String contextPath,
java.lang.String path,
boolean usebase)
public static boolean containKey(java.lang.String[] values,
java.lang.String key)
public static java.lang.String getNormalPath(java.lang.String parent,
java.lang.String file)
public static java.lang.String getFormatDate(java.util.Date date,
java.lang.String formate)
public static java.util.Date stringToDate(java.lang.String date)
public static java.util.Date stringToDate(java.lang.String date,
java.lang.String format_)
public static java.lang.String getFileName(java.lang.String path)
path - 文件路经public static java.lang.String getFileName(java.lang.String prefix,
java.lang.String extension)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic static java.lang.String[] dateArrayTOStringArray(java.util.Date[] dates)
dates - Date[] 日期数组public static java.util.Date[] stringArrayTODateArray(java.lang.String[] dates_s,
java.text.DateFormat dateformat)
public static java.util.Date[] longArrayTODateArray(long[] dates_s,
java.text.DateFormat dateformat)
public static java.sql.Date[] stringArrayTOSQLDateArray(java.lang.String[] dates_s,
java.text.DateFormat dateformat)
public static java.sql.Date[] longArrayTOSQLDateArray(long[] dates_s,
java.text.DateFormat dateformat)
public static java.sql.Timestamp[] stringArrayTOTimestampArray(java.lang.String[] dates_s,
java.text.DateFormat dateformat)
public static java.sql.Timestamp[] longArrayTOTimestampArray(long[] dates_s,
java.text.DateFormat dateformat)
public static java.lang.String replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement)
Replaces all occurrences of a String within another String.
A null reference passed to this method is a no-op.
StringUtils.replace(null, *, *) = null
StringUtils.replace("", *, *) = ""
StringUtils.replace("any", null, *) = "any"
StringUtils.replace("any", *, null) = "any"
StringUtils.replace("any", "", *) = "any"
StringUtils.replace("aba", "a", null) = "aba"
StringUtils.replace("aba", "a", "") = "b"
StringUtils.replace("aba", "a", "z") = "zbz"
text - text to search and replace in, may be nullsearchString - the String to search for, may be nullreplacement - the String to replace it with, may be nullnull if null String inputreplace(String text, String searchString, String replacement, int max)public static java.lang.String replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement,
int max)
Replaces a String with another String inside a larger String,
for the first max values of the search String.
A null reference passed to this method is a no-op.
StringUtils.replace(null, *, *, *) = null
StringUtils.replace("", *, *, *) = ""
StringUtils.replace("any", null, *, *) = "any"
StringUtils.replace("any", *, null, *) = "any"
StringUtils.replace("any", "", *, *) = "any"
StringUtils.replace("any", *, *, 0) = "any"
StringUtils.replace("abaa", "a", null, -1) = "abaa"
StringUtils.replace("abaa", "a", "", -1) = "b"
StringUtils.replace("abaa", "a", "z", 0) = "abaa"
StringUtils.replace("abaa", "a", "z", 1) = "zbaa"
StringUtils.replace("abaa", "a", "z", 2) = "zbza"
StringUtils.replace("abaa", "a", "z", -1) = "zbzz"
text - text to search and replace in, may be nullsearchString - the String to search for, may be nullreplacement - the String to replace it with, may be nullmax - maximum number of values to replace, or -1 if no maximumnull if null String inputpublic static java.lang.String replaceChars(java.lang.String str,
java.lang.String searchChars,
java.lang.String replaceChars)
str - searchChars - replaceChars - public static java.lang.String replaceNull(java.lang.String resource)
public static java.lang.String encode(java.lang.String s,
java.lang.String enc)
application/x-www-form-urlencoded
format using a specific encoding scheme. This method uses the supplied
encoding scheme to obtain the bytes for unsafe characters.
Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites.
s - String to be translated.enc - The name of a supported character encoding
.String.java.io.UnsupportedEncodingException - If the named encoding is not supportedURLDecoder.decode(String, String)public static java.lang.String encode(java.lang.String s)
application/x-www-form-urlencoded
format using a specific encoding scheme. This method uses the supplied
encoding scheme to obtain the bytes for unsafe characters.
Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites.
s - String to be translated.
The name of a supported character encoding
.String.java.io.UnsupportedEncodingException - If the named encoding is not supportedURLDecoder.decode(String, String)public static java.lang.String toUTF(java.lang.String inpara)
public static java.lang.String toGB2312(java.lang.String inpara)
public java.util.List splitString(java.lang.String src,
int size)
public java.lang.String splitString(java.lang.String src,
int offset,
int size)
public static java.lang.String replaceNull(java.lang.String value,
java.lang.String nullReplace)
public static boolean getBoolean(java.lang.String value,
boolean nullReplace)
public static int getInt(java.lang.String value,
int defaultValue)
public static boolean isJavascript(java.lang.String nodeLink)
nodeLink - public static java.lang.String buildStringMessage(java.util.List messages)
messages - public static boolean hasText(java.lang.String str)
public static boolean hasText(java.lang.CharSequence str)
true if the string not null,
its length is greater than 0, and it contains at least one non-whitespace character.
StringUtils.hasText(null) = false
StringUtils.hasText("") = false
StringUtils.hasText(" ") = false
StringUtils.hasText("12345") = true
StringUtils.hasText(" 12345 ") = true
str - the CharSequence to check (may be null)true if the CharSequence is not null,
its length is greater than 0, and it does not contain whitespace onlyCharacter.isWhitespace(char)public static boolean hasLength(java.lang.CharSequence str)
null nor of length 0.
Note: Will return true for a CharSequence that purely consists of whitespace.
StringUtils.hasLength(null) = false
StringUtils.hasLength("") = false
StringUtils.hasLength(" ") = true
StringUtils.hasLength("Hello") = true
str - the CharSequence to check (may be null)true if the CharSequence is not null and has lengthhasText(String)public static boolean startsWithIgnoreCase(java.lang.String str,
java.lang.String prefix)
str - the String to checkprefix - the prefix to look forString.startsWith(java.lang.String, int)public static boolean pathEquals(java.lang.String path1,
java.lang.String path2)
path1 - first path for comparisonpath2 - second path for comparisonpublic static java.lang.String cleanPath(java.lang.String path)
The result is convenient for path comparison. For other uses, notice that Windows separators ("\") are replaced by simple slashes.
path - the original pathpublic static java.lang.String[] delimitedListToStringArray(java.lang.String str,
java.lang.String delimiter)
A single delimiter can consists of more than one character: It will still
be considered as single delimiter string, rather than as bunch of potential
delimiter characters - in contrast to tokenizeToStringArray.
str - the input Stringdelimiter - the delimiter between elements (this is a single delimiter,
rather than a bunch individual delimiter characters)tokenizeToStringArray(java.lang.String, java.lang.String)public static java.lang.String[] delimitedListToStringArray(java.lang.String str,
java.lang.String delimiter,
java.lang.String charsToDelete)
A single delimiter can consists of more than one character: It will still
be considered as single delimiter string, rather than as bunch of potential
delimiter characters - in contrast to tokenizeToStringArray.
str - the input Stringdelimiter - the delimiter between elements (this is a single delimiter,
rather than a bunch individual delimiter characters)charsToDelete - a set of characters to delete. Useful for deleting unwanted
line breaks: e.g. "\r\n\f" will delete all new lines and line feeds in a String.tokenizeToStringArray(java.lang.String, java.lang.String)public static java.lang.String[] toStringArray(java.util.Collection collection)
collection - the Collection to copynull if the passed-in
Collection was null)public static java.lang.Integer[] toIntArray(java.util.Collection<java.lang.Integer> collection)
collection - the Collection to copynull if the passed-in
Collection was null)public static java.lang.String[] toStringArray(java.util.Enumeration enumeration)
enumeration - the Enumeration to copynull if the passed-in
Enumeration was null)public static java.lang.String[] trimArrayElements(java.lang.String[] array)
String.trim() on each of them.array - the original String arraypublic static java.lang.String[] removeDuplicateStrings(java.lang.String[] array)
array - the String arraypublic static java.lang.String deleteAny(java.lang.String inString,
java.lang.String charsToDelete)
inString - the original StringcharsToDelete - a set of characters to delete.
E.g. "az\n" will delete 'a's, 'z's and new lines.public static java.lang.String collectionToDelimitedString(java.util.Collection coll,
java.lang.String delim,
java.lang.String prefix,
java.lang.String suffix)
toString() implementations.coll - the Collection to displaydelim - the delimiter to use (probably a ",")prefix - the String to start each element withsuffix - the String to end each element withpublic static java.lang.String collectionToDelimitedString(java.util.Collection coll,
java.lang.String delim)
toString() implementations.coll - the Collection to displaydelim - the delimiter to use (probably a ",")public static java.lang.String collectionToCommaDelimitedString(java.util.Collection coll)
toString() implementations.coll - the Collection to displaypublic static java.lang.String[] tokenizeToStringArray(java.lang.String str,
java.lang.String delimiters)
The given delimiters string is supposed to consist of any number of
delimiter characters. Each of those characters can be used to separate
tokens. A delimiter is always a single character; for multi-character
delimiters, consider using delimitedListToStringArray
str - the String to tokenizedelimiters - the delimiter characters, assembled as String
(each of those characters is individually considered as delimiter).StringTokenizer,
String.trim(),
delimitedListToStringArray(java.lang.String, java.lang.String)public static java.lang.String[] tokenizeToStringArray(java.lang.String str,
java.lang.String delimiters,
boolean trimTokens,
boolean ignoreEmptyTokens)
The given delimiters string is supposed to consist of any number of
delimiter characters. Each of those characters can be used to separate
tokens. A delimiter is always a single character; for multi-character
delimiters, consider using delimitedListToStringArray
str - the String to tokenizedelimiters - the delimiter characters, assembled as String
(each of those characters is individually considered as delimiter)trimTokens - trim the tokens via String's trimignoreEmptyTokens - omit empty tokens from the result array
(only applies to tokens that are empty after trimming; StringTokenizer
will not consider subsequent delimiters as token in the first place).null if the input String
was null)StringTokenizer,
String.trim(),
delimitedListToStringArray(java.lang.String, java.lang.String)public static java.lang.String applyRelativePath(java.lang.String path,
java.lang.String relativePath)
path - the path to start from (usually a full file path)relativePath - the relative path to apply
(relative to the full file path above)public static java.lang.String getFilename(java.lang.String path)
path - the file path (may be null)null if nonepublic static java.lang.String arrayToCommaDelimitedString(java.lang.Object[] arr)
toString() implementations.arr - the array to displaypublic static java.lang.String arrayToDelimitedString(java.lang.Object[] arr,
java.lang.String delim)
toString() implementations.arr - the array to displaydelim - the delimiter to use (probably a ",")public static java.lang.String trimTrailingWhitespace(java.lang.String str)
str - the String to checkCharacter.isWhitespace(char)public static java.lang.String trimLeadingCharacter(java.lang.String str,
char leadingCharacter)
str - the String to checkleadingCharacter - the leading character to be trimmedpublic static java.lang.String trimTrailingCharacter(java.lang.String str,
char trailingCharacter)
str - the String to checktrailingCharacter - the trailing character to be trimmedpublic static java.lang.String trimLeadingWhitespace(java.lang.String str)
str - the String to checkCharacter.isWhitespace(char)public static int countOccurrencesOf(java.lang.String str,
java.lang.String sub)
str - string to search in. Return 0 if this is null.sub - string to search for. Return 0 if this is null.public static java.lang.String stripFilenameExtension(java.lang.String path)
path - the file path (may be null)null if nonepublic static java.lang.String[] commaDelimitedListToStringArray(java.lang.String str)
str - the input Stringpublic static java.lang.String[] addStringToArray(java.lang.String[] array,
java.lang.String str)
array - the array to append to (can be null)str - the String to appendnull)public static java.lang.String trimAllWhitespace(java.lang.String str)
str - the String to checkCharacter.isWhitespace(char)public static java.util.Locale parseLocaleString(java.lang.String localeString)
localeString into a Locale.
This is the inverse operation of Locale's toString.
localeString - the locale string, following Locale's
toString() format ("en", "en_UK", etc);
also accepts spaces as separators, as an alternative to underscoresLocale instancepublic static java.lang.String toLanguageTag(java.util.Locale locale)
locale - the Locale to transform to a language tagpublic static java.lang.String getFilenameExtension(java.lang.String path)
path - the file path (may be null)null if nonepublic static java.io.InputStream getInputStream(java.lang.String resourcefile,
java.lang.Class clazz)
throws java.io.IOException
java.io.IOExceptionpublic static java.util.Properties getProperties(java.lang.String resourcefile,
java.lang.Class clazz)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isEmpty(java.lang.String value)
public static boolean isNotEmpty(java.lang.String value)
public static boolean isEmpty(java.util.Collection cl)
public static boolean isNotEmpty(java.util.Collection cl)
public static boolean isEmpty(java.lang.Object obj)
public static boolean isNotEmpty(java.lang.Object obj)
public static java.lang.String formatException(java.lang.Throwable exception)
public static java.lang.String formatBRException(java.lang.Throwable exception)
public static java.lang.String exceptionToString(java.lang.Throwable exception)
public static java.lang.String urlencode(java.lang.String value,
java.lang.String charset,
int encodecount)
value - charset - encodecount - public static java.lang.String urlencode(java.lang.String value,
java.lang.String charset)
value - charset - public static java.util.Locale getLocale(java.lang.String locale)
public static java.util.Map<java.lang.String,java.util.Locale> getAllLocales()
public static java.util.Map<java.lang.String,java.util.Locale> converLocales(java.lang.String locales)
locales - public static java.lang.String tostring(java.lang.Object data)
public static void tostring(java.lang.StringBuilder ret,
java.lang.Object data)
public static java.lang.String formatTimeToString(long mss)
public static java.util.Enumeration arryToenum(java.lang.Object[] values)
public static java.lang.String native2ascii(java.lang.String s)
public static java.lang.String ascii2native(java.lang.String s)
public static final java.lang.String getOS()
public static final boolean isWindows()
public static final boolean isLinux()
public static final boolean isOSX()
public static java.lang.String newStringUtf8(byte[] bytes)
String by decoding the specified array of bytes using the UTF-8 charset.bytes - The bytes to be decoded into charactersString decoded from the specified array of bytes using the UTF-8 charset,
or null if the input byte array was null.java.lang.NullPointerException - Thrown if Charsets.UTF_8 is not initialized, which should never happen since it is
required by the Java platform specification.NullPointerException instead of UnsupportedEncodingExceptionpublic static byte[] getBytesUsAscii(java.lang.String string)
string - the String to encode, may be nullnull if the input string was nulljava.lang.NullPointerException - Thrown if Charsets.US_ASCII is not initialized, which should never happen since it is
required by the Java platform specification.NullPointerException instead of UnsupportedEncodingExceptionpublic static byte[] getBytesUtf16(java.lang.String string)
string - the String to encode, may be nullnull if the input string was nulljava.lang.NullPointerException - Thrown if Charsets.UTF_16 is not initialized, which should never happen since it is
required by the Java platform specification.NullPointerException instead of UnsupportedEncodingExceptionpublic static byte[] getBytesUtf16Be(java.lang.String string)
string - the String to encode, may be nullnull if the input string was nulljava.lang.NullPointerException - Thrown if Charsets.UTF_16BE is not initialized, which should never happen since it is
required by the Java platform specification.NullPointerException instead of UnsupportedEncodingExceptionpublic static byte[] getBytesUtf16Le(java.lang.String string)
string - the String to encode, may be nullnull if the input string was nulljava.lang.NullPointerException - Thrown if Charsets.UTF_16LE is not initialized, which should never happen since it is
required by the Java platform specification.NullPointerException instead of UnsupportedEncodingExceptionpublic static byte[] getBytesUtf8(java.lang.String string)
string - the String to encode, may be nullnull if the input string was nulljava.lang.NullPointerException - Thrown if Charsets.UTF_8 is not initialized, which should never happen since it is
required by the Java platform specification.NullPointerException instead of UnsupportedEncodingException