Package com.alibaba.druid.util
Class StringUtils
- java.lang.Object
-
- com.alibaba.druid.util.StringUtils
-
public class StringUtils extends Object
- Author:
- sandzhang[sandzhangtoo@gmail.com]
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequals(String a, String b)static booleanequalsIgnoreCase(String a, String b)static StringformatDateTime19(long millis, TimeZone timeZone)static booleanisEmpty(CharSequence value)static booleanisNumber(char[] chars)static booleanisNumber(String str)static intlowerHashCode(String text)static StringremoveNameQuotes(String s)static StringreplaceAll(String s, String src, String dest)static IntegerstringToInteger(String in)Converts a string representation of an integer to an Integer object.static StringsubString(String src, String start, String to)Example: subString("abcd","a","c")="b"static StringsubString(String src, String start, String to, boolean toLast)Example: subString("abcdc","a","c",true)="bcd"static IntegersubStringToInteger(String src, String start, String to)Example: subString("12345","1","4")=23
-
-
-
Method Detail
-
subStringToInteger
public static Integer subStringToInteger(String src, String start, String to)
Example: subString("12345","1","4")=23- Parameters:
src- the source string from which to extract the substringstart- the starting point of the substringto- the ending point of the substring- Returns:
- the extracted substring converted to an Integer, or null if any of the input strings is null
-
subString
public static String subString(String src, String start, String to)
Example: subString("abcd","a","c")="b"- Parameters:
src- the source string from which to extract the substringstart- null while start from index=0to- null while to index=src.length- Returns:
- the extracted substring, or null if any of the input strings is null
-
subString
public static String subString(String src, String start, String to, boolean toLast)
Example: subString("abcdc","a","c",true)="bcd"- Parameters:
src- the source string from which to extract the substringstart- null while start from index=0to- null while to index=src.lengthtoLast- true while to index=src.lastIndexOf(to)- Returns:
- the extracted substring, or null if any of the input strings is null, or if the start/end points are invalid
-
stringToInteger
public static Integer stringToInteger(String in)
Converts a string representation of an integer to an Integer object.- Parameters:
in- the input string to be converted (can be null)- Returns:
- the Integer object parsed from the input string, or null if the input is null, empty, or not a valid integer
-
isEmpty
public static boolean isEmpty(CharSequence value)
-
lowerHashCode
public static int lowerHashCode(String text)
-
isNumber
public static boolean isNumber(String str)
-
isNumber
public static boolean isNumber(char[] chars)
-
-