public class StringUtils
extends org.apache.commons.lang3.StringUtils
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
bigIntToString(BigInteger ipInBigInt)
将整数形式的ip地址转换为字符串形式
|
static byte[] |
decodeBase64(String str) |
static String |
decodeURL(String url) |
static String |
decodeUTF8StringBase64(String str) |
static String |
delHtmlTags(String htmlStr) |
static String |
encodeBase64(byte[] bytes) |
static String |
encodeURL(String url) |
static String |
encodeUTF8StringBase64(String str) |
static String |
getRandomNumber(int length)
获取指定位数的随机数字串
|
static String |
getRandomString(int length)
获取指定长度随机字符串
|
static boolean |
isChinaMobilePhone(String phone)
判断是否是中国移动手机号
|
static boolean |
isChinaMvnoPhone(String phone)
判断是否是中国虚拟运营商手机号
|
static boolean |
isChinaPhone(String phone)
判断是否是中国手机号
|
static boolean |
isChinaTelecomPhone(String phone)
判断是否是中国电信手机号
|
static boolean |
isChinaUnicomePhone(String phone)
判断是否是中国联通手机号
|
static boolean |
isDomain(String domain)
判断是否是域名格式
|
static boolean |
isEmail(String email)
判断是否是邮箱格式
|
static boolean |
isEmpty(CharSequence cs) |
static boolean |
isEmpty(Collection<?> coll)
* 判断一个Collection是否为空, 包含List,Set,Queue
|
static boolean |
isNotEmpty(CharSequence cs) |
static boolean |
isNull(Object object)
* 判断一个对象是否为空
|
static String |
signature(String... arr)
签名,先进行字典排序,再进行SHA1
|
static BigInteger |
stringToBigInt(String ipInString)
将字符串形式的ip地址转换为BigInteger
|
static String |
toStr(Object value,
String defaultValue)
转换为字符串
如果给定的值为null,或者转换失败,返回默认值 转换失败不会报错 |
abbreviate, abbreviate, abbreviate, abbreviate, abbreviateMiddle, appendIfMissing, appendIfMissingIgnoreCase, capitalize, center, center, center, chomp, chomp, chop, compare, compare, compareIgnoreCase, compareIgnoreCase, contains, contains, containsAny, containsAny, containsAny, containsAnyIgnoreCase, containsIgnoreCase, containsNone, containsNone, containsOnly, containsOnly, containsWhitespace, countMatches, countMatches, defaultIfBlank, defaultIfEmpty, defaultString, defaultString, deleteWhitespace, difference, endsWith, endsWithAny, endsWithIgnoreCase, equals, equalsAny, equalsAnyIgnoreCase, equalsIgnoreCase, firstNonBlank, firstNonEmpty, getBytes, getBytes, getCommonPrefix, getDigits, getFuzzyDistance, getIfBlank, getIfEmpty, getJaroWinklerDistance, getLevenshteinDistance, getLevenshteinDistance, indexOf, indexOf, indexOf, indexOf, indexOfAny, indexOfAny, indexOfAny, indexOfAnyBut, indexOfAnyBut, indexOfDifference, indexOfDifference, indexOfIgnoreCase, indexOfIgnoreCase, isAllBlank, isAllEmpty, isAllLowerCase, isAllUpperCase, isAlpha, isAlphanumeric, isAlphanumericSpace, isAlphaSpace, isAnyBlank, isAnyEmpty, isAsciiPrintable, isBlank, isMixedCase, isNoneBlank, isNoneEmpty, isNotBlank, isNumeric, isNumericSpace, isWhitespace, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, join, joinWith, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOfAny, lastIndexOfIgnoreCase, lastIndexOfIgnoreCase, lastOrdinalIndexOf, left, leftPad, leftPad, leftPad, length, lowerCase, lowerCase, mid, normalizeSpace, ordinalIndexOf, overlay, prependIfMissing, prependIfMissingIgnoreCase, remove, remove, removeAll, removeEnd, removeEndIgnoreCase, removeFirst, removeIgnoreCase, removePattern, removeStart, removeStartIgnoreCase, repeat, repeat, repeat, replace, replace, replaceAll, replaceChars, replaceChars, replaceEach, replaceEachRepeatedly, replaceFirst, replaceIgnoreCase, replaceIgnoreCase, replaceOnce, replaceOnceIgnoreCase, replacePattern, reverse, reverseDelimited, right, rightPad, rightPad, rightPad, rotate, split, split, split, split, splitByCharacterType, splitByCharacterTypeCamelCase, splitByWholeSeparator, splitByWholeSeparator, splitByWholeSeparatorPreserveAllTokens, splitByWholeSeparatorPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, startsWith, startsWithAny, startsWithIgnoreCase, strip, strip, stripAccents, stripAll, stripAll, stripEnd, stripStart, stripToEmpty, stripToNull, substring, substring, substringAfter, substringAfter, substringAfterLast, substringAfterLast, substringBefore, substringBefore, substringBeforeLast, substringBetween, substringBetween, substringsBetween, swapCase, toCodePoints, toEncodedString, toRootLowerCase, toRootUpperCase, toString, trim, trimToEmpty, trimToNull, truncate, truncate, uncapitalize, unwrap, unwrap, upperCase, upperCase, valueOf, wrap, wrap, wrapIfMissing, wrapIfMissingpublic static boolean isDomain(String domain)
domain - public static boolean isEmail(String email)
email - public static boolean isChinaPhone(String phone)
phone - public static boolean isChinaMobilePhone(String phone)
phone - public static boolean isChinaUnicomePhone(String phone)
phone - public static boolean isChinaTelecomPhone(String phone)
phone - public static boolean isChinaMvnoPhone(String phone)
phone - public static String signature(String... arr)
arr - 参与签名的值public static String getRandomString(int length)
length - 长度public static String getRandomNumber(int length)
length - 长度public static String encodeBase64(byte[] bytes)
public static byte[] decodeBase64(String str)
public static BigInteger stringToBigInt(String ipInString)
ipInString - 字符串形式的ip地址public static String bigIntToString(BigInteger ipInBigInt)
ipInBigInt - 整数形式的ip地址public static boolean isNotEmpty(CharSequence cs)
public static boolean isEmpty(CharSequence cs)
public static boolean isEmpty(Collection<?> coll)
coll - 要判断的Collectionpublic static boolean isNull(Object object)
object - ObjectCopyright © 2023. All rights reserved.