public class StringUtils extends Object
构造器和说明 |
---|
StringUtils() |
限定符和类型 | 方法和说明 |
---|---|
static Map<String,String> |
getParameters(String url) |
static void |
main(String[] args) |
static Integer |
stringToInteger(String in) |
static Long |
stringToLong(String in) |
static String |
subString(String src,
String start,
String to)
Example: subString("abcd","a","c")="b"
|
static Integer |
subStringToInteger(String src,
String start,
String to)
Example: subString("12345","1","4")=23
|
static String[] |
tokenizeToStringArray(String str,
String delimiters)
Tokenize the given String into a String array via a StringTokenizer.
|
static String[] |
tokenizeToStringArray(String str,
String delimiters,
boolean trimTokens,
boolean ignoreEmptyTokens)
Tokenize the given String into a String array via a StringTokenizer.
|
static String[] |
toStringArray(Collection collection)
Copy the given Collection into a String array.
|
public static Integer subStringToInteger(String src, String start, String to)
src
- start
- to
- public static String subString(String src, String start, String to)
src
- start
- null while start from index=0to
- null while to index=src.lengthpublic static String[] tokenizeToStringArray(String str, 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
Copied from the Spring Framework while retaining all license, copyright and author information.
str
- the String to tokenizedelimiters
- the delimiter characters, assembled as String (each of those characters is individually
considered as delimiter).StringTokenizer
,
String.trim()
public static String[] tokenizeToStringArray(String str, 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
Copied from the Spring Framework while retaining all license, copyright and author information.
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 trim
ignoreEmptyTokens
- 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()
public static String[] toStringArray(Collection collection)
Copied from the Spring Framework while retaining all license, copyright and author information.
collection
- the Collection to copynull
if the passed-in Collection was null
)public static void main(String[] args)
Copyright © 2012 Alibaba Group. All Rights Reserved.