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| Modifier and Type | Method and Description |
|---|---|
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 List<String> |
filterBlank(Collection<String> strings) |
static Set<String> |
filterBlank(Set<String> strings) |
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(CharSequence 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 |
isEmpty(CharSequence str) |
static boolean |
isIllegalChar(char c)
验证字符内容是否包含下列非法字符
`~!#%^&*=+\\|{};:'\",<>/?○●★☆☉♀♂※¤╬の〆 |
static boolean |
isNotEmpty(CharSequence str) |
static boolean |
isWord(char c)
校验某个字符是否是a-z、A-Z、_、0-9
|
static String |
join(CharSequence[] stringArray) |
static String |
join(CharSequence[] stringArray,
CharSequence separator) |
static String |
join(Collection<CharSequence> collection,
CharSequence separator) |
static boolean |
notBlank(CharSequence... strings) |
static boolean |
notBlank(CharSequence str) |
static boolean |
slowEquals(String a,
String b) |
static String |
str(byte[] data,
Charset charset)
解码字节码
|
static String |
str(Byte[] data,
Charset charset)
解码字节码
|
static String |
str(byte[] bytes,
String charset)
将byte数组转为字符串
|
static String |
str(Byte[] bytes,
String charset)
将Byte数组转为字符串
|
static String |
str(ByteBuffer data,
Charset charset)
将编码的byteBuffer数据转换为字符串
|
static String |
str(ByteBuffer data,
String charset)
将编码的byteBuffer数据转换为字符串
|
static String |
str(Object obj,
Charset charset)
将对象转为字符串
|
static String |
str(Object obj,
String charsetName)
将对象转为字符串
|
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) |
static String |
utf8Str(Object obj)
将对象转为字符串
|
public static boolean isBlank(CharSequence str)
public static boolean notBlank(CharSequence str)
public static boolean notBlank(CharSequence... strings)
public static boolean isEmpty(CharSequence str)
public static boolean isNotEmpty(CharSequence str)
public static String join(CharSequence[] stringArray)
public static String join(CharSequence[] stringArray, CharSequence separator)
public static String join(Collection<CharSequence> collection, CharSequence separator)
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 - 被校验的字符串public static List<String> filterBlank(Collection<String> strings)
public static String utf8Str(Object obj)
1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
obj - 对象public static String str(Object obj, String charsetName)
1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
obj - 对象charsetName - 字符集public static String str(Object obj, Charset charset)
1、Byte数组和ByteBuffer会被转换为对应字符串的数组
2、对象数组会调用Arrays.toString方法
obj - 对象charset - 字符集public static String str(byte[] bytes, String charset)
bytes - byte数组charset - 字符集public static String str(byte[] data, Charset charset)
data - 字符串charset - 字符集,如果此字段为空,则解码的结果取决于平台public static String str(Byte[] bytes, String charset)
bytes - byte数组charset - 字符集public static String str(Byte[] data, Charset charset)
data - 字符串charset - 字符集,如果此字段为空,则解码的结果取决于平台public static String str(ByteBuffer data, String charset)
data - 数据charset - 字符集,如果为空使用当前系统字符集public static String str(ByteBuffer data, Charset charset)
data - 数据charset - 字符集,如果为空使用当前系统字符集Copyright © 2021. All rights reserved.