java.lang.Object
org.apache.commons.lang3.StringUtils
io.github.mangocrisp.spring.taybct.tool.core.util.StringUtil

public class StringUtil extends org.apache.commons.lang3.StringUtils
字符串工具类
从以下版本开始:
1.0.0
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final int
     

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

    CR, EMPTY, LF, SPACE
  • 构造器概要

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

    修饰符和类型
    方法
    说明
    创建StringBuilder对象
    创建StringBuilder对象
    builder(int capacity)
    创建StringBuilder对象
    创建StringBuilder对象
    static String
    清理字符串,清理出某些不可见字符
    static boolean
    contains(CharSequence str, char searchChar)
    指定字符是否在字符串中出现过
    static boolean
    是否包含特定字符,忽略大小写,如果给定两个参数都为null,返回true
    static int
    count(CharSequence content, char charForSearch)
    统计指定内容中包含指定字符的数量
    static String
    encrypt(String input)
    加密脱敏字符串默认保留一个字符(头尾)
    static String
    encrypt(String[] arr, int begin, int end, String chr, int maxChar)
     
    static String
    encrypt(String input, int keep)
     
    static String
    encrypt(String input, int begin, int end)
     
    static String
    encrypt(String input, int begin, int end, int maxChar)
     
    static String
    encrypt(String input, int begin, int end, String chr)
     
    static String
    encrypt(String input, int begin, int end, String chr, int maxChar)
    加密字符串
    static String
    encrypt(String input, int keep, String chr)
     
    static String
    encrypt(String input, int keep, String chr, int maxChar)
     
    static boolean
    比较两个字符串(大小写敏感)。
    static boolean
    equals(CharSequence str1, CharSequence str2, boolean ignoreCase)
    比较两个字符串是否相等。
    static boolean
    比较两个字符串(大小写不敏感)。
    static List<String>
    根据传入的字符串,输出字符串所有大小写组合集合
    获得StringReader
    获得StringWriter
    static String
    驼峰转横线
    static String
    驼峰转下划线
    static String
    indexedFormat(CharSequence pattern, Object... arguments)
    有序的格式化文本,使用{number}做为占位符
    例:
    通常使用:format("this is {0} for {1}", "a", "b") =》 this is a for b
    static int
    indexOf(CharSequence str, char searchChar)
    指定范围内查找指定字符
    static int
    indexOf(CharSequence str, char searchChar, int start)
    指定范围内查找指定字符
    static int
    indexOf(CharSequence str, char searchChar, int start, int end)
    指定范围内查找指定字符
    static int
    indexOf(CharSequence str, CharSequence searchStr, int fromIndex, boolean ignoreCase)
    指定范围内反向查找字符串
    static int
    指定范围内查找字符串,忽略大小写
    static int
    indexOfIgnoreCase(CharSequence str, CharSequence searchStr, int fromIndex)
    指定范围内查找字符串
    static boolean
    isSubEquals(CharSequence str1, int start1, CharSequence str2, int start2, int length, boolean ignoreCase)
    截取两个字符串的不同部分(长度一致),判断截取的子串是否相同
    任意一个字符串为null返回false
    static int
    lastIndexOf(CharSequence str, CharSequence searchStr, int fromIndex, boolean ignoreCase)
    指定范围内查找字符串
    static int
    指定范围内查找字符串,忽略大小写
    static int
    lastIndexOfIgnoreCase(CharSequence str, CharSequence searchStr, int fromIndex)
    指定范围内查找字符串,忽略大小写
    static String
    横线转驼峰
    static String
    首字母变小写
    static int
    ordinalIndexOf(String str, String searchStr, int ordinal)
    返回字符串 searchStr 在字符串 str 中第 ordinal 次出现的位置。
    static String
    生成uuid
    static String
    去掉指定前缀
    static String
    忽略大小写去掉指定前缀
    static String
    去掉指定后缀,并小写首字母
    static String
    去掉指定后缀
    static String
    忽略大小写去掉指定后缀
    static String
    sub(CharSequence str, int fromIndex, int toIndex)
    改进JDK subString
    index从0开始计算,最后一个字符为-1
    如果from和to位置一样,返回 ""
    如果from或to为负数,则按照length从后向前数位置,如果绝对值大于字符串长度,则from归到0,to归到length
    如果经过修正的index中from大于to,则互换from和to example:
    abcdefgh 2 3 =》 c
    abcdefgh 2 -3 =》 cde
    static String
    subAfter(CharSequence string, CharSequence separator, boolean isLastSeparator)
    截取分隔字符串之后的字符串,不包括分隔字符串
    如果给定的字符串为空串(null或""),返回原字符串
    如果分隔字符串为空串(null或""),则返回空串,如果分隔字符串未找到,返回空串
    static String
    subBefore(CharSequence string, CharSequence separator, boolean isLastSeparator)
    截取分隔字符串之前的字符串,不包括分隔字符串
    如果给定的字符串为空串(null或"")或者分隔字符串为null,返回原字符串
    如果分隔字符串为空串"",则返回空串,如果分隔字符串未找到,返回原字符串
    static String
    subBetween(CharSequence str, CharSequence beforeAndAfter)
    截取指定字符串中间部分,不包括标识字符串
    static String
    截取指定字符串中间部分,不包括标识字符串
    static String
    subPre(CharSequence string, int toIndex)
    切割指定位置之前部分的字符串
    static String
    subSuf(CharSequence string, int fromIndex)
    切割指定位置之后部分的字符串
    static String
    下划线转驼峰
    static String
    首字母变大写

    从类继承的方法 org.apache.commons.lang3.StringUtils

    abbreviate, abbreviate, abbreviate, abbreviate, abbreviateMiddle, appendIfMissing, appendIfMissingIgnoreCase, capitalize, center, center, center, chomp, chomp, chop, compare, compare, compareIgnoreCase, compareIgnoreCase, contains, contains, containsAny, containsAny, containsAny, containsAnyIgnoreCase, containsNone, containsNone, containsOnly, containsOnly, containsWhitespace, countMatches, countMatches, defaultIfBlank, defaultIfEmpty, defaultString, defaultString, deleteWhitespace, difference, endsWith, endsWithAny, endsWithIgnoreCase, equalsAny, equalsAnyIgnoreCase, firstNonBlank, firstNonEmpty, getBytes, getBytes, getCommonPrefix, getDigits, getFuzzyDistance, getIfBlank, getIfEmpty, getJaroWinklerDistance, getLevenshteinDistance, getLevenshteinDistance, indexOf, indexOf, indexOf, indexOf, indexOfAny, indexOfAny, indexOfAny, indexOfAnyBut, indexOfAnyBut, indexOfDifference, indexOfDifference, 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, join, join, joinWith, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOfAny, lastOrdinalIndexOf, left, leftPad, leftPad, leftPad, length, lowerCase, lowerCase, mid, normalizeSpace, ordinalIndexOf, overlay, prependIfMissing, prependIfMissingIgnoreCase, remove, remove, removeAll, removeEnd, removeEndIgnoreCase, removeFirst, removeIgnoreCase, removePattern, removeStart, 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, wrapIfMissing

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

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

    • INDEX_NOT_FOUND

      public static final int INDEX_NOT_FOUND
      另请参阅:
  • 构造器详细资料

    • StringUtil

      public StringUtil()
  • 方法详细资料

    • encrypt

      public static String encrypt(String input, int begin, int end)
    • encrypt

      public static String encrypt(String input, int begin, int end, String chr)
    • encrypt

      public static String encrypt(String input, int begin, int end, int maxChar)
    • encrypt

      public static String encrypt(String input, int keep)
    • encrypt

      public static String encrypt(String input, int keep, String chr)
    • encrypt

      public static String encrypt(String input, int keep, String chr, int maxChar)
    • encrypt

      public static String encrypt(String input)
      加密脱敏字符串默认保留一个字符(头尾)
      参数:
      input - 输入字符串
      从以下版本开始:
      1.0.0
    • encrypt

      public static String encrypt(String input, int begin, int end, String chr, int maxChar)
      加密字符串
      参数:
      input - 输入字符串
      begin - 头保留
      end - 尾保留
      maxChar - 最大加密字符长度
      chr - 加密字符
      从以下版本开始:
      1.0.0
    • encrypt

      public static String encrypt(String[] arr, int begin, int end, String chr, int maxChar)
    • randomUUID

      public static String randomUUID()
      生成uuid
      从以下版本开始:
      1.0.0
    • cleanChars

      public static String cleanChars(String txt)
      清理字符串,清理出某些不可见字符
      参数:
      txt - 字符串
      从以下版本开始:
      1.0.0
    • indexedFormat

      public static String indexedFormat(CharSequence pattern, Object... arguments)
      有序的格式化文本,使用{number}做为占位符
      例:
      通常使用:format("this is {0} for {1}", "a", "b") =》 this is a for b
      参数:
      pattern - 文本格式
      arguments - 参数
      返回:
      格式化后的文本
    • contains

      public static boolean contains(CharSequence str, char searchChar)
      指定字符是否在字符串中出现过
      参数:
      str - 字符串
      searchChar - 被查找的字符
      返回:
      是否包含
      从以下版本开始:
      1.0.0
    • containsIgnoreCase

      public static boolean containsIgnoreCase(CharSequence str, CharSequence testStr)
      是否包含特定字符,忽略大小写,如果给定两个参数都为null,返回true
      参数:
      str - 被检测字符串
      testStr - 被测试是否包含的字符串
      返回:
      是否包含
      从以下版本开始:
      1.0.0
    • sub

      public static String sub(CharSequence str, int fromIndex, int toIndex)
      改进JDK subString
      index从0开始计算,最后一个字符为-1
      如果from和to位置一样,返回 ""
      如果from或to为负数,则按照length从后向前数位置,如果绝对值大于字符串长度,则from归到0,to归到length
      如果经过修正的index中from大于to,则互换from和to example:
      abcdefgh 2 3 =》 c
      abcdefgh 2 -3 =》 cde
      参数:
      str - String
      fromIndex - 开始的index(包括)
      toIndex - 结束的index(不包括)
      返回:
      字串
      从以下版本开始:
      1.0.0
    • subBefore

      public static String subBefore(CharSequence string, CharSequence separator, boolean isLastSeparator)
      截取分隔字符串之前的字符串,不包括分隔字符串
      如果给定的字符串为空串(null或"")或者分隔字符串为null,返回原字符串
      如果分隔字符串为空串"",则返回空串,如果分隔字符串未找到,返回原字符串

      栗子:

       StringUtil.subBefore(null, *)      = null
       StringUtil.subBefore("", *)        = ""
       StringUtil.subBefore("abc", "a")   = ""
       StringUtil.subBefore("abcba", "b") = "a"
       StringUtil.subBefore("abc", "c")   = "ab"
       StringUtil.subBefore("abc", "d")   = "abc"
       StringUtil.subBefore("abc", "")    = ""
       StringUtil.subBefore("abc", null)  = "abc"
       
      参数:
      string - 被查找的字符串
      separator - 分隔字符串(不包括)
      isLastSeparator - 是否查找最后一个分隔字符串(多次出现分隔字符串时选取最后一个),true为选取最后一个
      返回:
      切割后的字符串
      从以下版本开始:
      1.0.0
    • subAfter

      public static String subAfter(CharSequence string, CharSequence separator, boolean isLastSeparator)
      截取分隔字符串之后的字符串,不包括分隔字符串
      如果给定的字符串为空串(null或""),返回原字符串
      如果分隔字符串为空串(null或""),则返回空串,如果分隔字符串未找到,返回空串

      栗子:

       StringUtil.subAfter(null, *)      = null
       StringUtil.subAfter("", *)        = ""
       StringUtil.subAfter(*, null)      = ""
       StringUtil.subAfter("abc", "a")   = "bc"
       StringUtil.subAfter("abcba", "b") = "cba"
       StringUtil.subAfter("abc", "c")   = ""
       StringUtil.subAfter("abc", "d")   = ""
       StringUtil.subAfter("abc", "")    = "abc"
       
      参数:
      string - 被查找的字符串
      separator - 分隔字符串(不包括)
      isLastSeparator - 是否查找最后一个分隔字符串(多次出现分隔字符串时选取最后一个),true为选取最后一个
      返回:
      切割后的字符串
      从以下版本开始:
      1.0.0
    • subBetween

      public static String subBetween(CharSequence str, CharSequence before, CharSequence after)
      截取指定字符串中间部分,不包括标识字符串

      栗子:

       StringUtil.subBetween("wx[b]yz", "[", "]") = "b"
       StringUtil.subBetween(null, *, *)          = null
       StringUtil.subBetween(*, null, *)          = null
       StringUtil.subBetween(*, *, null)          = null
       StringUtil.subBetween("", "", "")          = ""
       StringUtil.subBetween("", "", "]")         = null
       StringUtil.subBetween("", "[", "]")        = null
       StringUtil.subBetween("yabcz", "", "")     = ""
       StringUtil.subBetween("yabcz", "y", "z")   = "abc"
       StringUtil.subBetween("yabczyabcz", "y", "z")   = "abc"
       
      参数:
      str - 被切割的字符串
      before - 截取开始的字符串标识
      after - 截取到的字符串标识
      返回:
      截取后的字符串
      从以下版本开始:
      1.0.0
    • subBetween

      public static String subBetween(CharSequence str, CharSequence beforeAndAfter)
      截取指定字符串中间部分,不包括标识字符串

      栗子:

       StringUtil.subBetween(null, *)            = null
       StringUtil.subBetween("", "")             = ""
       StringUtil.subBetween("", "tag")          = null
       StringUtil.subBetween("tagabctag", null)  = null
       StringUtil.subBetween("tagabctag", "")    = ""
       StringUtil.subBetween("tagabctag", "tag") = "abc"
       
      参数:
      str - 被切割的字符串
      beforeAndAfter - 截取开始和结束的字符串标识
      返回:
      截取后的字符串
      从以下版本开始:
      1.0.0
    • removePrefix

      public static String removePrefix(CharSequence str, CharSequence prefix)
      去掉指定前缀
      参数:
      str - 字符串
      prefix - 前缀
      返回:
      切掉后的字符串,若前缀不是 preffix, 返回原字符串
      从以下版本开始:
      1.0.0
    • removePrefixIgnoreCase

      public static String removePrefixIgnoreCase(CharSequence str, CharSequence prefix)
      忽略大小写去掉指定前缀
      参数:
      str - 字符串
      prefix - 前缀
      返回:
      切掉后的字符串,若前缀不是 prefix, 返回原字符串
    • removeSuffix

      public static String removeSuffix(CharSequence str, CharSequence suffix)
      去掉指定后缀
      参数:
      str - 字符串
      suffix - 后缀
      返回:
      切掉后的字符串,若后缀不是 suffix, 返回原字符串
    • removeSufAndLowerFirst

      public static String removeSufAndLowerFirst(CharSequence str, CharSequence suffix)
      去掉指定后缀,并小写首字母
      参数:
      str - 字符串
      suffix - 后缀
      返回:
      切掉后的字符串,若后缀不是 suffix, 返回原字符串
    • removeSuffixIgnoreCase

      public static String removeSuffixIgnoreCase(CharSequence str, CharSequence suffix)
      忽略大小写去掉指定后缀
      参数:
      str - 字符串
      suffix - 后缀
      返回:
      切掉后的字符串,若后缀不是 suffix, 返回原字符串
    • lowerFirst

      public static String lowerFirst(String str)
      首字母变小写
      参数:
      str - 字符串
      返回:
      {String}
    • upperFirst

      public static String upperFirst(String str)
      首字母变大写
      参数:
      str - 字符串
      返回:
      {String}
    • subPre

      public static String subPre(CharSequence string, int toIndex)
      切割指定位置之前部分的字符串
      参数:
      string - 字符串
      toIndex - 切割到的位置(不包括)
      返回:
      切割后的剩余的前半部分字符串
    • subSuf

      public static String subSuf(CharSequence string, int fromIndex)
      切割指定位置之后部分的字符串
      参数:
      string - 字符串
      fromIndex - 切割开始的位置(包括)
      返回:
      切割后后剩余的后半部分字符串
    • indexOf

      public static int indexOf(CharSequence str, char searchChar)
      指定范围内查找指定字符
      参数:
      str - 字符串
      searchChar - 被查找的字符
      返回:
      位置
    • indexOf

      public static int indexOf(CharSequence str, char searchChar, int start)
      指定范围内查找指定字符
      参数:
      str - 字符串
      searchChar - 被查找的字符
      start - 起始位置,如果小于0,从0开始查找
      返回:
      位置
    • indexOf

      public static int indexOf(CharSequence str, char searchChar, int start, int end)
      指定范围内查找指定字符
      参数:
      str - 字符串
      searchChar - 被查找的字符
      start - 起始位置,如果小于0,从0开始查找
      end - 终止位置,如果超过str.length()则默认查找到字符串末尾
      返回:
      位置
    • indexOfIgnoreCase

      public static int indexOfIgnoreCase(CharSequence str, CharSequence searchStr)
      指定范围内查找字符串,忽略大小写
       StringUtil.indexOfIgnoreCase(null, *, *)          = -1
       StringUtil.indexOfIgnoreCase(*, null, *)          = -1
       StringUtil.indexOfIgnoreCase("", "", 0)           = 0
       StringUtil.indexOfIgnoreCase("aabaabaa", "A", 0)  = 0
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", 0)  = 2
       StringUtil.indexOfIgnoreCase("aabaabaa", "AB", 0) = 1
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", 3)  = 5
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", 9)  = -1
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", -1) = 2
       StringUtil.indexOfIgnoreCase("aabaabaa", "", 2)   = 2
       StringUtil.indexOfIgnoreCase("abc", "", 9)        = -1
       
      参数:
      str - 字符串
      searchStr - 需要查找位置的字符串
      返回:
      位置
      从以下版本开始:
      1.0.0
    • indexOfIgnoreCase

      public static int indexOfIgnoreCase(CharSequence str, CharSequence searchStr, int fromIndex)
      指定范围内查找字符串
       StringUtil.indexOfIgnoreCase(null, *, *)          = -1
       StringUtil.indexOfIgnoreCase(*, null, *)          = -1
       StringUtil.indexOfIgnoreCase("", "", 0)           = 0
       StringUtil.indexOfIgnoreCase("aabaabaa", "A", 0)  = 0
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", 0)  = 2
       StringUtil.indexOfIgnoreCase("aabaabaa", "AB", 0) = 1
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", 3)  = 5
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", 9)  = -1
       StringUtil.indexOfIgnoreCase("aabaabaa", "B", -1) = 2
       StringUtil.indexOfIgnoreCase("aabaabaa", "", 2)   = 2
       StringUtil.indexOfIgnoreCase("abc", "", 9)        = -1
       
      参数:
      str - 字符串
      searchStr - 需要查找位置的字符串
      fromIndex - 起始位置
      返回:
      位置
      从以下版本开始:
      1.0.0
    • indexOf

      public static int indexOf(CharSequence str, CharSequence searchStr, int fromIndex, boolean ignoreCase)
      指定范围内反向查找字符串
      参数:
      str - 字符串
      searchStr - 需要查找位置的字符串
      fromIndex - 起始位置
      ignoreCase - 是否忽略大小写
      返回:
      位置
      从以下版本开始:
      1.0.0
    • lastIndexOfIgnoreCase

      public static int lastIndexOfIgnoreCase(CharSequence str, CharSequence searchStr)
      指定范围内查找字符串,忽略大小写
      参数:
      str - 字符串
      searchStr - 需要查找位置的字符串
      返回:
      位置
      从以下版本开始:
      1.0.0
    • lastIndexOfIgnoreCase

      public static int lastIndexOfIgnoreCase(CharSequence str, CharSequence searchStr, int fromIndex)
      指定范围内查找字符串,忽略大小写
      参数:
      str - 字符串
      searchStr - 需要查找位置的字符串
      fromIndex - 起始位置,从后往前计数
      返回:
      位置
      从以下版本开始:
      1.0.0
    • lastIndexOf

      public static int lastIndexOf(CharSequence str, CharSequence searchStr, int fromIndex, boolean ignoreCase)
      指定范围内查找字符串
      参数:
      str - 字符串
      searchStr - 需要查找位置的字符串
      fromIndex - 起始位置,从后往前计数
      ignoreCase - 是否忽略大小写
      返回:
      位置
      从以下版本开始:
      1.0.0
    • ordinalIndexOf

      public static int ordinalIndexOf(String str, String searchStr, int ordinal)
      返回字符串 searchStr 在字符串 str 中第 ordinal 次出现的位置。
      此方法来自:Apache-Commons-Lang

      栗子(*代表任意字符):

       StringUtil.ordinalIndexOf(null, *, *)          = -1
       StringUtil.ordinalIndexOf(*, null, *)          = -1
       StringUtil.ordinalIndexOf("", "", *)           = 0
       StringUtil.ordinalIndexOf("aabaabaa", "a", 1)  = 0
       StringUtil.ordinalIndexOf("aabaabaa", "a", 2)  = 1
       StringUtil.ordinalIndexOf("aabaabaa", "b", 1)  = 2
       StringUtil.ordinalIndexOf("aabaabaa", "b", 2)  = 5
       StringUtil.ordinalIndexOf("aabaabaa", "ab", 1) = 1
       StringUtil.ordinalIndexOf("aabaabaa", "ab", 2) = 4
       StringUtil.ordinalIndexOf("aabaabaa", "", 1)   = 0
       StringUtil.ordinalIndexOf("aabaabaa", "", 2)   = 0
       
      参数:
      str - 被检查的字符串,可以为null
      searchStr - 被查找的字符串,可以为null
      ordinal - 第几次出现的位置
      返回:
      查找到的位置
      从以下版本开始:
      1.0.0
    • isSubEquals

      public static boolean isSubEquals(CharSequence str1, int start1, CharSequence str2, int start2, int length, boolean ignoreCase)
      截取两个字符串的不同部分(长度一致),判断截取的子串是否相同
      任意一个字符串为null返回false
      参数:
      str1 - 第一个字符串
      start1 - 第一个字符串开始的位置
      str2 - 第二个字符串
      start2 - 第二个字符串开始的位置
      length - 截取长度
      ignoreCase - 是否忽略大小写
      返回:
      子串是否相同
      从以下版本开始:
      1.0.0
    • equals

      public static boolean equals(CharSequence str1, CharSequence str2)
      比较两个字符串(大小写敏感)。
       equalsIgnoreCase(null, null)   = true
       equalsIgnoreCase(null, "abc")  = false
       equalsIgnoreCase("abc", null)  = false
       equalsIgnoreCase("abc", "abc") = true
       equalsIgnoreCase("abc", "ABC") = true
       
      参数:
      str1 - 要比较的字符串1
      str2 - 要比较的字符串2
      返回:
      如果两个字符串相同,或者都是null,则返回true
    • equalsIgnoreCase

      public static boolean equalsIgnoreCase(CharSequence str1, CharSequence str2)
      比较两个字符串(大小写不敏感)。
       equalsIgnoreCase(null, null)   = true
       equalsIgnoreCase(null, "abc")  = false
       equalsIgnoreCase("abc", null)  = false
       equalsIgnoreCase("abc", "abc") = true
       equalsIgnoreCase("abc", "ABC") = true
       
      参数:
      str1 - 要比较的字符串1
      str2 - 要比较的字符串2
      返回:
      如果两个字符串相同,或者都是null,则返回true
    • equals

      public static boolean equals(CharSequence str1, CharSequence str2, boolean ignoreCase)
      比较两个字符串是否相等。
      参数:
      str1 - 要比较的字符串1
      str2 - 要比较的字符串2
      ignoreCase - 是否忽略大小写
      返回:
      如果两个字符串相同,或者都是null,则返回true
      从以下版本开始:
      1.0.0
    • builder

      public static StringBuilder builder()
      创建StringBuilder对象
      返回:
      StringBuilder对象
    • builder

      public static StringBuilder builder(int capacity)
      创建StringBuilder对象
      参数:
      capacity - 初始大小
      返回:
      StringBuilder对象
    • builder

      public static StringBuilder builder(CharSequence... strs)
      创建StringBuilder对象
      参数:
      strs - 初始字符串列表
      返回:
      StringBuilder对象
    • appendBuilder

      public static StringBuilder appendBuilder(StringBuilder sb, CharSequence... strs)
      创建StringBuilder对象
      参数:
      sb - 初始StringBuilder
      strs - 初始字符串列表
      返回:
      StringBuilder对象
    • getReader

      public static StringReader getReader(CharSequence str)
      获得StringReader
      参数:
      str - 字符串
      返回:
      StringReader
    • getWriter

      public static StringWriter getWriter()
      获得StringWriter
      返回:
      StringWriter
    • count

      public static int count(CharSequence content, char charForSearch)
      统计指定内容中包含指定字符的数量
      参数:
      content - 内容
      charForSearch - 被统计的字符
      返回:
      包含数量
    • underlineToHump

      public static String underlineToHump(String para)
      下划线转驼峰
      参数:
      para - 字符串
      返回:
      String
    • humpToUnderline

      public static String humpToUnderline(String para)
      驼峰转下划线
      参数:
      para - 字符串
      返回:
      String
    • lineToHump

      public static String lineToHump(String para)
      横线转驼峰
      参数:
      para - 字符串
      返回:
      String
    • humpToLine

      public static String humpToLine(String para)
      驼峰转横线
      参数:
      para - 字符串
      返回:
      String
    • getArrayListByString

      public static List<String> getArrayListByString(String str)
      根据传入的字符串,输出字符串所有大小写组合集合
      参数:
      str - 输入字符串
      返回:
      所有组合