public class StringUtil
extends org.apache.commons.lang3.StringUtils
| 构造器和说明 |
|---|
StringUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
arrayToStr(Object[] objs)
将一个数组对象转换成一个字符串
|
static <T> T |
cast(Object obj) |
static String |
convertToCamelCase(String name)
将下划线大写方式命名的字符串转换为驼峰式。
|
static boolean |
inStringIgnoreCase(String str,
String... strs)
是否包含字符串
|
static boolean |
isArray(Object object)
* 判断一个对象是否是数组类型(Java基本型别的数组)
|
static boolean |
isEmpty(Collection<?> coll)
* 判断一个Collection是否为空, 包含List,Set,Queue
|
static boolean |
isEmpty(Map<?,?> map)
* 判断一个Map是否为空
|
static boolean |
isEmpty(Object[] objects)
判断一个对象数组是否为空
|
static boolean |
isEmpty(String str)
* 判断一个字符串是否为空串
|
static boolean |
ishttp(String link)
是否为http(s)://开头
|
static boolean |
isNotEmpty(Collection<?> coll)
* 判断一个Collection是否非空,包含List,Set,Queue
|
static boolean |
isNotEmpty(Map<?,?> map)
* 判断一个Map是否为空
|
static boolean |
isNotEmpty(Object[] objects)
* 判断一个对象数组是否非空
|
static boolean |
isNotEmpty(String str)
* 判断一个字符串是否为非空串
|
static boolean |
isNotNull(Object object)
* 判断一个对象是否非空
|
static boolean |
isNull(Object object)
* 判断一个对象是否为空
|
static <T> T |
nvl(T value,
T defaultValue)
获取参数不为空值
|
static List<String> |
str2List(String str,
String sep,
boolean filterBlank,
boolean trim)
字符串转list
|
static Set<String> |
str2Set(String str,
String sep)
字符串转set
|
static String |
substring(String str,
int start)
截取字符串
|
static String |
substring(String str,
int start,
int end)
截取字符串
|
static String |
toCamelCase(String s)
驼峰式命名法 例如:user_name转换为userName
|
static String |
toUnderScoreCase(String str)
驼峰转下划线命名
|
static String |
trim(String str)
去空格
|
abbreviate, abbreviate, abbreviate, abbreviate, abbreviateMiddle, appendIfMissing, appendIfMissingIgnoreCase, capitalize, center, center, center, chomp, chomp, chop, compare, compare, compareIgnoreCase, compareIgnoreCase, contains, contains, containsAny, containsAny, containsAny, containsIgnoreCase, containsNone, containsNone, containsOnly, containsOnly, containsWhitespace, countMatches, countMatches, defaultIfBlank, defaultIfEmpty, defaultString, defaultString, deleteWhitespace, difference, endsWith, endsWithAny, endsWithIgnoreCase, equals, equalsAny, equalsAnyIgnoreCase, equalsIgnoreCase, firstNonBlank, firstNonEmpty, getCommonPrefix, getDigits, getFuzzyDistance, 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, isEmpty, isMixedCase, isNoneBlank, isNoneEmpty, isNotBlank, isNotEmpty, 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, 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, substringAfter, substringAfterLast, substringBefore, substringBeforeLast, substringBetween, substringBetween, substringsBetween, swapCase, toCodePoints, toEncodedString, toString, trimToEmpty, trimToNull, truncate, truncate, uncapitalize, unwrap, unwrap, upperCase, upperCase, valueOf, wrap, wrap, wrapIfMissing, wrapIfMissingpublic static <T> T nvl(T value,
T defaultValue)
T - 泛型value - 要判断的valuedefaultValue - 默认的valuepublic static boolean isEmpty(Collection<?> coll)
coll - 要判断的Collectionpublic static boolean isNotEmpty(Collection<?> coll)
coll - 要判断的Collectionpublic static boolean isEmpty(Object[] objects)
objects - 要判断的对象数组public static boolean isNotEmpty(Object[] objects)
objects - 要判断的对象数组public static boolean isEmpty(Map<?,?> map)
map - 要判断的Mappublic static boolean isNotEmpty(Map<?,?> map)
map - 要判断的Mappublic static boolean isEmpty(String str)
str - Stringpublic static boolean isNotEmpty(String str)
str - Stringpublic static boolean isNull(Object object)
object - Objectpublic static boolean isNotNull(Object object)
object - Objectpublic static boolean isArray(Object object)
object - 对象public static String substring(String str, int start)
str - 字符串start - 开始public static String substring(String str, int start, int end)
str - 字符串start - 开始end - 结束public static boolean ishttp(String link)
link - 链接public static final Set<String> str2Set(String str, String sep)
str - 字符串sep - 分隔符public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim)
str - 字符串sep - 分隔符filterBlank - 过滤纯空白trim - 去掉首尾空白public static String toUnderScoreCase(String str)
str - 待处理字符串public static boolean inStringIgnoreCase(String str, String... strs)
str - 验证字符串strs - 字符串组public static String convertToCamelCase(String name)
name - 转换前的下划线大写方式命名的字符串public static String toCamelCase(String s)
s - 待处理的字符串public static <T> T cast(Object obj)
Copyright © 2021. All rights reserved.