public class StringUtil
extends org.apache.commons.lang3.StringUtils
StringUtils| 限定符 | 构造器和说明 |
|---|---|
protected |
StringUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
checkStringLength(String str,
int length,
boolean allowNull)
判断字符串是否超长
|
static String |
createUUID()
生成length位随机UUID随机主键
|
static String |
filterAllSpace(String str)
去除所有空格
|
static String |
filterSearchKey(String str,
String... filterKey)
关键字去空格及过滤
|
static String |
filterSearchKeyAndReplace(String str,
String... filterKey)
关键字去空格及过滤 如果出现关键字将替换为空
|
static String |
filterSpace(String str)
去除两端空格
|
static String |
firstCharacterToUpper(String srcStr)
首字母大写
|
static String |
getUUIDForLength(int length)
生成length位随机UUID随机主键
|
static boolean |
isAllBlank(Object... param)
是否全部参数都为空
|
static boolean |
isBlank(Object... param)
是否包含参数值为空的数据
|
static String |
isBlankWithDefault(String cs,
String def)
判断是否为空 如果为空则返回默认值
|
static boolean |
isChinese(String str,
String... keywords)
判断是否为中文
|
static boolean |
isContainChinese(String str)
字符串是否包含中文
|
static String |
likeSearch(String key,
int type,
String... filterKey)
关键字 模糊查询
|
static String |
pickUpChinese(String source)
提取字符串中的中文
|
static String |
removeFormat(String str)
删除格式
|
static String |
replaceUnderline(String str)
替换下划线 并且把下划线后的第一个单词大写
|
static String |
replaceUnderline(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, 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, 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, substringAfterLast, substringBefore, substringBeforeLast, substringBetween, substringBetween, substringsBetween, swapCase, toCodePoints, toEncodedString, toString, trim, trimToEmpty, trimToNull, truncate, truncate, uncapitalize, unwrap, unwrap, upperCase, upperCase, wrap, wrap, wrapIfMissing, wrapIfMissingpublic static boolean isBlank(Object... param)
param - 需要检查的为空的参数们public static String isBlankWithDefault(String cs, String def)
cs - 判断的字符串def - 默认值字符串public static boolean isAllBlank(Object... param)
param - 需要检查的为空的参数们public static String filterSearchKey(String str, String... filterKey)
str - filterKey - public static String filterSearchKeyAndReplace(String str, String... filterKey)
str - filterKey - public static String likeSearch(String key, int type, String... filterKey)
key - type - -1 为%key 0为 %key% 1为key% 其他默认为0public static String createUUID()
public static String getUUIDForLength(int length)
public static boolean checkStringLength(String str, int length, boolean allowNull)
str - 待定字符串length - 长度allowNull - 是否可以为空public static String replaceUnderline(String str)
str - public static String replaceUnderline(String[] str)
str - public static String firstCharacterToUpper(String srcStr)
srcStr - public static boolean isContainChinese(String str)
str - 待校验字符串public static boolean isChinese(String str, String... keywords)
str - 原字符串keywords - 需要过滤的字符(即包含此字符将视为中文)Copyright © 2020. All rights reserved.