public final class StrKit extends Object implements StringPoolKit
AMPERSAND, AND, ASTERISK, AT, BACK_SLASH, BACKTICK, BYTES_NEW_LINE, COLON, COMMA, CRLF, DASH, DOLLAR, DOLLAR_LEFT_BRACE, DOT, DOT_CLASS, DOT_JAVA, DOT_NEWLINE, DOT_XML, DOTDOT, EMPTY, EMPTY_ARRAY, EQUALS, EXCLAMATION_MARK, FALSE, HASH, HASH_LEFT_BRACE, HAT, HTML_AMP, HTML_GT, HTML_LT, HTML_NBSP, HTML_QUOTE, ISO_8859_1, LEFT_BRACE, LEFT_BRACKET, LEFT_CHEV, LEFT_SQ_BRACKET, N, NEWLINE, NO, NULL, OFF, ON, ONE, PERCENT, PIPE, PLUS, QUESTION_MARK, QUOTE, RETURN, RIGHT_BRACE, RIGHT_BRACKET, RIGHT_CHEV, RIGHT_SQ_BRACKET, SEMICOLON, SINGLE_QUOTE, SLASH, SPACE, STAR, TAB, TILDA, TRUE, UNDERSCORE, US_ASCII, UTF_8, Y, YES, ZERO| 限定符和类型 | 方法和说明 |
|---|---|
static int[] |
convertCharToInt(char[] c)
将字符数组转为整型数组
|
static String |
defaultIfBlank(String str,
String defaultValue) |
static boolean |
equals(CharSequence cs1,
CharSequence cs2)
Compares two CharSequences, returning
true if they represent
equal sequences of characters. |
static boolean |
equals(String a,
String b) |
static boolean |
equalsAny(CharSequence string,
CharSequence... searchStrings)
Compares given
string to a CharSequences vararg of searchStrings,
returning true if the string is equal to any of the searchStrings. |
static String |
filterChinese(String string)
过滤掉中文
|
static String |
firstCharToLowerCase(String str)
首字母变小写
|
static String |
firstCharToUpperCase(String str)
首字母变大写
|
static String |
getRandomUUID() |
static boolean |
hasIllegalChar(String string)
验证字符串内容是否包含下列非法字符
`~! |
static boolean |
isBlank(String str)
字符串为 null 或者内部字符全部为 ' ' '\t' '\n' '\r' 这四类字符时返回 true
|
static boolean |
isChinese(char c)
判定输入的是否是汉字
|
static boolean |
isChinese(String string)
校验String是否全是中文
|
static boolean |
isChineseChar(char c)
校验一个字符是否是汉字
|
static boolean |
isContainChinese(String str)
判断字符串中是否包含中文
|
static boolean |
isIllegalChar(char c)
验证字符内容是否包含下列非法字符
`~! |
static boolean |
isWord(char c)
校验某个字符是否是a-z、A-Z、_、0-9
|
static String |
join(List<String> list,
String separator) |
static String |
join(String[] stringArray) |
static String |
join(String[] stringArray,
String separator) |
static boolean |
notBlank(String... strings) |
static boolean |
notBlank(String str) |
static boolean |
notNull(Object... paras) |
static boolean |
slowEquals(String a,
String b) |
static String |
toCamelCase(String stringWithUnderline) |
static Double |
toDouble(String obj) |
static Float |
toFloat(String obj) |
static Integer |
toInteger(String obj) |
static Long |
toLong(String obj) |
public static boolean isBlank(String str)
public static boolean notBlank(String str)
public static boolean notBlank(String... strings)
public static boolean notNull(Object... paras)
public static String getRandomUUID()
public static boolean equalsAny(CharSequence string, CharSequence... searchStrings)
Compares given string to a CharSequences vararg of searchStrings,
returning true if the string is equal to any of the searchStrings.
StringUtils.equalsAny(null, (CharSequence[]) null) = false
StringUtils.equalsAny(null, null, null) = true
StringUtils.equalsAny(null, "abc", "def") = false
StringUtils.equalsAny("abc", null, "def") = false
StringUtils.equalsAny("abc", "abc", "def") = true
StringUtils.equalsAny("abc", "ABC", "DEF") = false
string - to compare, may be null.searchStrings - a vararg of strings, may be null.true if the string is equal (case-sensitive) to any other element of searchStrings;
false if searchStrings is null or contains no matches.public static boolean equals(CharSequence cs1, CharSequence cs2)
Compares two CharSequences, returning true if they represent
equal sequences of characters.
nulls are handled without exceptions. Two null
references are considered to be equal. The comparison is case sensitive.
StringUtils.equals(null, null) = true
StringUtils.equals(null, "abc") = false
StringUtils.equals("abc", null) = false
StringUtils.equals("abc", "abc") = true
StringUtils.equals("abc", "ABC") = false
cs1 - the first CharSequence, may be nullcs2 - the second CharSequence, may be nulltrue if the CharSequences are equal (case-sensitive), or both nullObject.equals(Object)public static int[] convertCharToInt(char[] c)
throws NumberFormatException
c - NumberFormatExceptionpublic static boolean isContainChinese(String str)
str - 待校验字符串public static String filterChinese(String string)
string - 待过滤中文的字符串public static boolean isChineseChar(char c)
c - 被校验的字符public static boolean hasIllegalChar(String string)
string - 字符串内容public static boolean isIllegalChar(char c)
c - 字符public static boolean isWord(char c)
c - 被校验的字符public static boolean isChinese(char c)
c - 被校验的字符public static boolean isChinese(String string)
string - 被校验的字符串Copyright © 2021. All rights reserved.