类 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日
版本:
0.1
作者:
jingma
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final String
    子节点KEY

    从类继承的字段 org.apache.commons.lang.StringUtils

    EMPTY, INDEX_NOT_FOUND
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static String
    addInput(String zddm, Object value)
    beetl-支持通配符的判断
    static com.alibaba.fastjson.JSONArray
    buildTree(List<com.alibaba.fastjson.JSONObject> list, String upkey, String key)
    构建的树数据,要求根节点为空,默认根据为:_root
    static com.alibaba.fastjson.JSONArray
    buildTree(List<com.alibaba.fastjson.JSONObject> list, String upkey, String key, String rootKey)
    构建的树数据,要求根节点为空
    static String
    bytesToHexString(byte[] byteArray)
    Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。
    static void
    clEqDate(com.alibaba.fastjson.JSONObject field, com.alibaba.fastjson.JSONObject yobj)
    beetl-时间范围查询
    static String
    desDeByField(String data, com.alibaba.fastjson.JSONObject field)
    基于字段配置用des算法对字段进行解密密
    static String
    desEnByField(String data, com.alibaba.fastjson.JSONObject field)
    基于字段配置用des算法对字段进行加密
    static String
    获取字符串全拼
    static String
    获取字符串简拼
    static String
     
    static byte[]
    Convert hex string to byte[]
    static boolean
    判断对象是否为空或空字符串
    static String
    strJoin(List<String> list, String separator)
    字符串拼接
    static String
    转为utf8
    static String
    下划线规则的命名转换为驼峰式命名
    static String
    将字符串首字母转换为大写
    static <T> T
    valByDef(T val, T def)
    当传入的值为空时,采用默认值
    static Boolean
    校验字符串是否纯数字,无长度限制
    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

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

  • 构造器详细资料

    • StringUtil

      public StringUtil()
  • 方法详细资料

    • getUUIDUpperStr

      public static String getUUIDUpperStr()
      返回:
      随机32位大写UUID
    • isBlank

      public static boolean isBlank(Object obj)
      判断对象是否为空或空字符串
      参数:
      obj - 对象
      返回:
      true:对象为空或空字符串,false:非空
    • valByDef

      public static <T> T valByDef(T val, T def)
      当传入的值为空时,采用默认值
      参数:
      val - 传入值
      def - 默认值
      返回:
      val为空时采用def
    • strJoin

      public static String strJoin(List<String> list, String separator)
      字符串拼接
      参数:
      list - 字符串列表
      separator - 分隔符
      返回:
      拼接结果
    • validateNumber

      public static Boolean validateNumber(String str)
      校验字符串是否纯数字,无长度限制
      参数:
      str - 待验证字符串
      返回:
      true:数字,false:非数字
    • underlineTohump

      public static String underlineTohump(String name)
      下划线规则的命名转换为驼峰式命名
      参数:
      name - 原名称
      返回:
      转换后名称
    • upperCaseFast

      public static String upperCaseFast(String name)
      将字符串首字母转换为大写
      参数:
      name - 原名称
      返回:
      转换结果
    • addInput

      public static String addInput(String zddm, Object value)
      beetl-支持通配符的判断
      参数:
      zddm - 字段名称
      value - 值
    • clEqDate

      public static void clEqDate(com.alibaba.fastjson.JSONObject field, com.alibaba.fastjson.JSONObject yobj)
      beetl-时间范围查询
      参数:
      field - 字段对象
      yobj - 前端传入表单
    • desEnByField

      public static String desEnByField(String data, com.alibaba.fastjson.JSONObject field)
      基于字段配置用des算法对字段进行加密
      参数:
      data - 待加密的数据
      field - 字段信息
      返回:
      加密结果
    • desDeByField

      public static String desDeByField(String data, com.alibaba.fastjson.JSONObject field)
      基于字段配置用des算法对字段进行解密密
      参数:
      data - 待解密数据
      field - 字段信息
      返回:
      解密结果
    • getSimpleSpell

      public static String getSimpleSpell(String source) throws com.github.stuxuhai.jpinyin.PinyinException
      获取字符串简拼
      参数:
      source - 来源字符串
      返回:
      来源字符串的简拼
      抛出:
      com.github.stuxuhai.jpinyin.PinyinException - 拼音异常
    • getFullSpell

      public static String getFullSpell(String source) throws com.github.stuxuhai.jpinyin.PinyinException
      获取字符串全拼
      参数:
      source - 来源字符串
      返回:
      来源字符串的全拼
      抛出:
      com.github.stuxuhai.jpinyin.PinyinException - 拼音异常
    • bytesToHexString

      public static String bytesToHexString(byte[] byteArray)
      Convert byte[] to hex string.这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。
      参数:
      byteArray - byte[] data
      返回:
      hexString string
    • hexStringToBytes

      public static byte[] hexStringToBytes(String hexString)
      Convert hex string to byte[]
      参数:
      hexString - the hex string
      返回:
      byte[]
    • toUtf8

      public static String toUtf8(String s)
      转为utf8
      参数:
      s - 待转字符串
      返回:
      转换结果
    • whether

      public static String whether(Object obj)
    • 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