类 StringUtils
java.lang.Object
cn.gomro.commons.utils.StringUtils
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static StringaddZeroForNum(String str, int strLength) 生成指定位数的字符串,不够补0static String在开头和结尾处附加逗号static boolean字符串长度区间static String将下划线大写方式命名的字符串转换为驼峰式。static String集合字符串转去重后的文本 乱序 去重 [1,2,3,4] ==> 1,2,3,4 [1,,3,4] ==> 1,3,4 [,1,,3,4,] ==> 1,3,4 [,1,3,3,4,] ==> 1,3,4static StringcollectionToCommaString(Collection<?> coll) 集合字符串转文本 有序 不去重 [1,2,3,4] ==> 1,2,3,4 [1,,3,4] ==> 1,3,4 [,1,,3,4,] ==> 1,3,4 [,1,3,3,4,] ==> 1,3,4static LinkedHashSet<String>逗号分割转Set a,b,c,d ==> [a,b,c,d] a,,c,d ==> [a,c,d] ,a,,c,d, ==> [a,c,d]逗号分割转List 1,2,3,4 ==> [1,2,3,4] 1,,3,4 ==> [1,3,4] ,1,,3,4, ==> [1,3,4]逗号分割转List1,2,3,4 ==> [1,2,3,4] 1,,3,4 ==> [1,3,4] ,1,,3,4, ==> [1,3,4] ,abc, ==> [] 逗号分割转List1,2,3,4 ==> [1,2,3,4] 1,,3,4 ==> [1,3,4] ,1,,3,4, ==> [1,3,4] abc, ==> [] 逗号分割转Set a,b,c,d ==> [a,b,c,d] a,,c,d ==> [a,c,d] ,a,,c,d, ==> [a,c,d]static String逗号分割去空去重static booleancompareIsRepeat(String[] strs) 验证数组中是否有相同字符串static booleancontains(CharSequence str, CharSequence searchStr) static booleancontainsAny(Collection<String> coll1, Collection<String> coll2) static booleancontainsAnyIgnoreCase(Collection<String> coll1, Collection<String> coll2) static booleanendsWithIgnoreCase(String str, String prefix) static booleanequalsIgnoreCase(CharSequence str1, CharSequence str2) static StringescapeQuotes(String val) 封装双引号static Stringstatic StringfilterSpecial(String val) 过滤特殊字符串static boolean判断字符串是否NULL或空static booleanisLetterOrDigits(String str) static boolean判断是否为空白字符static boolean判断字符串是否为NULLstatic Stringstatic int字符串长度static StringlistToString(List<Integer> ids) List1,2,3 - > String"1,2,3" static String转小写字母static boolean字符串最大长度static boolean判断字符串非NULLstatic StringNULL转空static StringNULL转默认值static String随机生成8位字符串static StringrepeatString(String name, String s) 字符串去重分号分割转List1;2;3;4 ==> [1,2,3,4] 1;;3;4 ==> [1,3,4] ;1;;3,;4; ==> [1,3,4] abc; ==> [] static String[]static booleanstartsWithIgnoreCase(String str, String prefix) static String逗号分割,每个元素前拼接单引号 无序static DoublestringToDouble(String val, Double defaultValue) String to DoublestringToListInteger(String val, String s) 字符串转ListstringToListLong(String val, String s) 字符串转Liststatic Stringstatic StringtoSqlInString(String str) 逗号分割去空去重 逗号分割,每个元素前拼接单引号 null ==> '' '' ==> '' 1 ==> '1' 1,ab ==> '1','ab' 1,2,3,4,, ==> '1','2','3','4'static Stringstatic Stringunderline2Camel(String line, boolean... smallCamel) 下划线转驼峰法(默认小驼峰)static StringunderscoreName(String name) 将驼峰式命名的字符串转换为下划线大写方式。static booleanverifyToSqlInString(String param)
-
字段详细资料
-
UTF8
- 另请参阅:
-
GB2312
- 另请参阅:
-
GBK
- 另请参阅:
-
PatternUsername
- 另请参阅:
-
PatternEmail
- 另请参阅:
-
PatternPhone
- 另请参阅:
-
PatternMobile
- 另请参阅:
-
PatternIp
- 另请参阅:
-
PatternUrl
- 另请参阅:
-
PatternIdCard
- 另请参阅:
-
PatternAge
- 另请参阅:
-
PatternPostal
- 另请参阅:
-
PatternSmsAuthCode
- 另请参阅:
-
PatternInt
- 另请参阅:
-
PatternIntPositive
- 另请参阅:
-
PatternIntNegative
- 另请参阅:
-
PatternDouble
- 另请参阅:
-
PatternDoublePositive
- 另请参阅:
-
PatternDoubleNegative
- 另请参阅:
-
PatternEnglish
- 另请参阅:
-
PatternEnglishNumeric
- 另请参阅:
-
PatternEnglishNumericUnderline
- 另请参阅:
-
PatternChinese
- 另请参阅:
-
PatternChineseEnglishNumeric
- 另请参阅:
-
PatternSpecial
- 另请参阅:
-
PatternDate
- 另请参阅:
-
PatternDatetime
- 另请参阅:
-
PatternScientificA
- 另请参阅:
-
PatternScientificB
- 另请参阅:
-
PatternScientificC
- 另请参阅:
-
PatternScientificD
- 另请参阅:
-
-
构造器详细资料
-
StringUtils
public StringUtils()
-
-
方法详细资料
-
lowerCase
转小写字母 -
equalsIgnoreCase
-
isNotBlank
判断是否为空白字符 -
commaDelimitedTrimEmptySet
逗号分割转Set a,b,c,d ==> [a,b,c,d] a,,c,d ==> [a,c,d] ,a,,c,d, ==> [a,c,d] -
commaDelimitedTrimEmptyLinkedHashSet
逗号分割转Set a,b,c,d ==> [a,b,c,d] a,,c,d ==> [a,c,d] ,a,,c,d, ==> [a,c,d] -
commaDelimitedTrimEmptyList
逗号分割转List 1,2,3,4 ==> [1,2,3,4] 1,,3,4 ==> [1,3,4] ,1,,3,4, ==> [1,3,4] -
split
-
commaDelimitedTrimEmptyListInteger
逗号分割转List1,2,3,4 ==> [1,2,3,4] 1,,3,4 ==> [1,3,4] ,1,,3,4, ==> [1,3,4] ,abc, ==> [] -
commaDelimitedTrimEmptyListLong
逗号分割转List1,2,3,4 ==> [1,2,3,4] 1,,3,4 ==> [1,3,4] ,1,,3,4, ==> [1,3,4] abc, ==> [] -
commaDelimitedTrimEmptyString
逗号分割去空去重, ==> "" a,b,c,d ==> a,b,c,d a,,c,d ==> a,c,d ,a,,c,d, ==> a,c,d ,a,c,c,d, ==> a,c,d
-
stringToCommaDistinctString
逗号分割,每个元素前拼接单引号 无序1,2,3,4 ==> '1','2','3','4'
-
toSqlInString
逗号分割去空去重 逗号分割,每个元素前拼接单引号 null ==> '' '' ==> '' 1 ==> '1' 1,ab ==> '1','ab' 1,2,3,4,, ==> '1','2','3','4'- 参数:
str-- 返回:
-
escapeSql
-
collectionToCommaDistinctString
集合字符串转去重后的文本 乱序 去重 [1,2,3,4] ==> 1,2,3,4 [1,,3,4] ==> 1,3,4 [,1,,3,4,] ==> 1,3,4 [,1,3,3,4,] ==> 1,3,4 -
collectionToCommaString
集合字符串转文本 有序 不去重 [1,2,3,4] ==> 1,2,3,4 [1,,3,4] ==> 1,3,4 [,1,,3,4,] ==> 1,3,4 [,1,3,3,4,] ==> 1,3,4 -
startsWithIgnoreCase
-
endsWithIgnoreCase
-
appendCommaAtStartAndEnd
在开头和结尾处附加逗号 -
strip
-
semicolonDelimitedTrimEmptyListLong
分号分割转List1;2;3;4 ==> [1,2,3,4] 1;;3;4 ==> [1,3,4] ;1;;3,;4; ==> [1,3,4] abc; ==> [] -
underscoreName
将驼峰式命名的字符串转换为下划线大写方式。如果转换前的驼峰式命名的字符串为空,则返回空字符串。 例如:HelloWorld->HELLO_WORLD- 参数:
name- 转换前的驼峰式命名的字符串- 返回:
- 转换后下划线大写方式命名的字符串
-
camelName
将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld- 参数:
name- 转换前的下划线大写方式命名的字符串- 返回:
- 转换后的驼峰式命名的字符串
-
underline2Camel
下划线转驼峰法(默认小驼峰)- 参数:
line- 源字符串smallCamel- 大小驼峰,是否为小驼峰(驼峰,第一个字符是大写还是小写)- 返回:
- 转换后的字符串
-
contains
-
join
-
trim
-
escapeQuotes
封装双引号- 参数:
val-- 返回:
-
len
字符串长度- 参数:
val-- 返回:
-
max
字符串最大长度- 参数:
val-len-- 返回:
-
between
字符串长度区间- 参数:
val-minLen-maxLen-- 返回:
-
filterSpecial
过滤特殊字符串- 参数:
val-- 返回:
-
isBlank
判断字符串是否NULL或空- 参数:
val-- 返回:
-
isNull
判断字符串是否为NULL- 参数:
val-- 返回:
-
notNull
判断字符串非NULL- 参数:
val-- 返回:
-
nullToStr
NULL转空- 参数:
val-- 返回:
-
nullToStr
NULL转默认值- 参数:
val-def-- 返回:
-
addZeroForNum
生成指定位数的字符串,不够补0- 参数:
str- 字符串strLength- 指定长度- 返回:
-
repeatString
字符串去重- 参数:
name- 字符串s- 分隔条件- 返回:
-
stringToListInteger
字符串转List -
stringToDouble
String to Double- 参数:
val-defaultValue-- 返回:
-
stringToListLong
字符串转List -
listToString
List1,2,3 - > String"1,2,3" - 参数:
ids-- 返回:
-
randomStr8
随机生成8位字符串- 返回:
-
isLetterOrDigits
-
containsAny
-
containsAnyIgnoreCase
-
verifyToSqlInString
-
compareIsRepeat
验证数组中是否有相同字符串- 参数:
strs-- 返回:
-