类 StringUtil
java.lang.Object
org.apache.commons.lang.StringUtils
cn.benma666.myutils.StringUtil
public class StringUtil
extends org.apache.commons.lang.StringUtils
字符串工具类
date: 2021年1月6日
date: 2021年1月6日
- 版本:
- 0.1
- 作者:
- jingma
-
字段概要
字段从类继承的字段 org.apache.commons.lang.StringUtils
EMPTY, INDEX_NOT_FOUND -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static Stringbeetl-支持通配符的判断static com.alibaba.fastjson.JSONArray构建的树数据,要求根节点为空,默认根据为:_rootstatic com.alibaba.fastjson.JSONArray构建的树数据,要求根节点为空static StringbytesToHexString(byte[] byteArray) Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。static voidclEqDate(com.alibaba.fastjson.JSONObject field, com.alibaba.fastjson.JSONObject yobj) beetl-时间范围查询static StringdesDeByField(String data, com.alibaba.fastjson.JSONObject field) 基于字段配置用des算法对字段进行解密密static StringdesEnByField(String data, com.alibaba.fastjson.JSONObject field) 基于字段配置用des算法对字段进行加密static StringgetFullSpell(String source) 获取字符串全拼static StringgetSimpleSpell(String source) 获取字符串简拼static Stringstatic byte[]hexStringToBytes(String hexString) Convert hex string to byte[]static boolean判断对象是否为空或空字符串static String字符串拼接static String转为utf8static StringunderlineTohump(String name) 下划线规则的命名转换为驼峰式命名static StringupperCaseFast(String name) 将字符串首字母转换为大写static <T> TvalByDef(T val, T def) 当传入的值为空时,采用默认值static BooleanvalidateNumber(String str) 校验字符串是否纯数字,无长度限制static String从类继承的方法 org.apache.commons.lang.StringUtils
abbreviate, abbreviate, abbreviateMiddle, capitalise, capitaliseAllWords, capitalize, center, center, center, chomp, chomp, chompLast, chompLast, chop, chopNewline, clean, concatenate, contains, contains, containsAny, containsAny, containsIgnoreCase, containsNone, containsNone, containsOnly, containsOnly, countMatches, defaultIfEmpty, defaultString, defaultString, deleteSpaces, deleteWhitespace, difference, endsWith, endsWithIgnoreCase, equals, equalsIgnoreCase, escape, getChomp, getCommonPrefix, getLevenshteinDistance, getNestedString, getNestedString, getPrechomp, indexOf, indexOf, indexOf, indexOf, indexOfAny, indexOfAny, indexOfAny, indexOfAnyBut, indexOfAnyBut, indexOfDifference, indexOfDifference, indexOfIgnoreCase, indexOfIgnoreCase, isAllLowerCase, isAllUpperCase, isAlpha, isAlphanumeric, isAlphanumericSpace, isAlphaSpace, isAsciiPrintable, isBlank, isEmpty, isNotBlank, isNotEmpty, isNumeric, isNumericSpace, isWhitespace, join, join, join, join, join, join, join, join, join, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOfAny, lastIndexOfIgnoreCase, lastIndexOfIgnoreCase, lastOrdinalIndexOf, left, leftPad, leftPad, leftPad, length, lowerCase, lowerCase, mid, ordinalIndexOf, overlay, overlayString, prechomp, remove, remove, removeEnd, removeEndIgnoreCase, removeStart, removeStartIgnoreCase, repeat, repeat, replace, replace, replaceChars, replaceChars, replaceEach, replaceEachRepeatedly, replaceOnce, reverse, reverseDelimited, reverseDelimitedString, right, rightPad, rightPad, rightPad, split, split, split, split, splitByCharacterType, splitByCharacterTypeCamelCase, splitByWholeSeparator, splitByWholeSeparator, splitByWholeSeparatorPreserveAllTokens, splitByWholeSeparatorPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, splitPreserveAllTokens, startsWith, startsWithAny, startsWithIgnoreCase, strip, strip, stripAll, stripAll, stripEnd, stripStart, stripToEmpty, stripToNull, substring, substring, substringAfter, substringAfterLast, substringBefore, substringBeforeLast, substringBetween, substringBetween, substringsBetween, swapCase, trim, trimToEmpty, trimToNull, uncapitalise, uncapitalize, upperCase, upperCase
-
字段详细资料
-
KEY_CHILDREN
子节点KEY- 另请参阅:
-
-
构造器详细资料
-
StringUtil
public StringUtil()
-
-
方法详细资料
-
getUUIDUpperStr
- 返回:
- 随机32位大写UUID
-
isBlank
判断对象是否为空或空字符串- 参数:
obj- 对象- 返回:
- true:对象为空或空字符串,false:非空
-
valByDef
public static <T> T valByDef(T val, T def) 当传入的值为空时,采用默认值- 参数:
val- 传入值def- 默认值- 返回:
- val为空时采用def
-
strJoin
字符串拼接- 参数:
list- 字符串列表separator- 分隔符- 返回:
- 拼接结果
-
validateNumber
校验字符串是否纯数字,无长度限制- 参数:
str- 待验证字符串- 返回:
- true:数字,false:非数字
-
underlineTohump
下划线规则的命名转换为驼峰式命名- 参数:
name- 原名称- 返回:
- 转换后名称
-
upperCaseFast
将字符串首字母转换为大写- 参数:
name- 原名称- 返回:
- 转换结果
-
addInput
beetl-支持通配符的判断- 参数:
zddm- 字段名称value- 值
-
clEqDate
public static void clEqDate(com.alibaba.fastjson.JSONObject field, com.alibaba.fastjson.JSONObject yobj) beetl-时间范围查询- 参数:
field- 字段对象yobj- 前端传入表单
-
desEnByField
基于字段配置用des算法对字段进行加密- 参数:
data- 待加密的数据field- 字段信息- 返回:
- 加密结果
-
desDeByField
基于字段配置用des算法对字段进行解密密- 参数:
data- 待解密数据field- 字段信息- 返回:
- 解密结果
-
getSimpleSpell
public static String getSimpleSpell(String source) throws com.github.stuxuhai.jpinyin.PinyinException 获取字符串简拼- 参数:
source- 来源字符串- 返回:
- 来源字符串的简拼
- 抛出:
com.github.stuxuhai.jpinyin.PinyinException- 拼音异常
-
getFullSpell
获取字符串全拼- 参数:
source- 来源字符串- 返回:
- 来源字符串的全拼
- 抛出:
com.github.stuxuhai.jpinyin.PinyinException- 拼音异常
-
bytesToHexString
Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。- 参数:
byteArray- byte[] data- 返回:
- hexString string
-
hexStringToBytes
Convert hex string to byte[]- 参数:
hexString- the hex string- 返回:
- byte[]
-
toUtf8
转为utf8- 参数:
s- 待转字符串- 返回:
- 转换结果
-
whether
-
buildTree
public static com.alibaba.fastjson.JSONArray buildTree(List<com.alibaba.fastjson.JSONObject> list, String upkey, String key) 构建的树数据,要求根节点为空,默认根据为:_root- 参数:
list- 数据列表upkey- 父节点字段key- 与父节点对应的字段
-
buildTree
public static com.alibaba.fastjson.JSONArray buildTree(List<com.alibaba.fastjson.JSONObject> list, String upkey, String key, String rootKey) 构建的树数据,要求根节点为空- 参数:
list- 数据列表upkey- 父节点字段key- 与父节点对应的字段rootKey- 根节点key,默认:_root
-