程序包 dev.utils.common

类 StringUtils

java.lang.Object
dev.utils.common.StringUtils

public final class StringUtils extends Object
detail: 字符串工具类
作者:
Ttt
  • 方法详细资料

    • isEmpty

      public static boolean isEmpty(CharSequence str)
      判断字符串是否为 null
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isEmpty

      public static boolean isEmpty(CharSequence... args)
      判断多个字符串是否存在为 null 的字符串
      参数:
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isEmptyClear

      public static boolean isEmptyClear(String str)
      判断字符串是否为 null ( 调用 clearSpaceTabLineTrim )
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isEmptyClear

      public static boolean isEmptyClear(String... args)
      判断多个字符串是否存在为 null 的字符串 ( 调用 clearSpaceTabLineTrim )
      参数:
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isNotEmpty

      public static boolean isNotEmpty(CharSequence str)
      判断字符串是否不为 null
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isNotEmptyClear

      public static boolean isNotEmptyClear(String str)
      判断字符串是否不为 null ( 调用 clearSpaceTabLineTrim )
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isNull

      public static boolean isNull(String str)
      判断字符串是否为 "null"
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isNull

      public static boolean isNull(String... args)
      判断多个字符串是否存在为 "null" 的字符串
      参数:
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isNullClear

      public static boolean isNullClear(String str)
      判断字符串是否为 "null" ( 调用 clearSpaceTabLineTrim )
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isNullClear

      public static boolean isNullClear(String... args)
      判断多个字符串是否存在为 "null" 的字符串 ( 调用 clearSpaceTabLineTrim )
      参数:
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isNotNull

      public static boolean isNotNull(String str)
      判断字符串是否不为 "null"
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • isNotNullClear

      public static boolean isNotNullClear(String str)
      判断字符串是否不为 "null" ( 调用 clearSpaceTabLineTrim )
      参数:
      str - 待校验的字符串
      返回:
      true yes, false no
    • length

      public static int length(String str)
      获取字符串长度
      参数:
      str - 待校验的字符串
      返回:
      字符串长度, 如果字符串为 null, 则返回 0
    • length

      public static int length(String str, int defaultLength)
      获取字符串长度
      参数:
      str - 待校验的字符串
      defaultLength - 字符串为 null 时, 返回的长度
      返回:
      字符串长度, 如果字符串为 null, 则返回 defaultLength
    • isLength

      public static boolean isLength(String str, int length)
      获取字符串长度 是否等于期望长度
      参数:
      str - 待校验的字符串
      length - 期望长度
      返回:
      true yes, false no
    • equals

      public static <T> boolean equals(T value1, T value2)
      判断两个值是否一样
      类型参数:
      T - 泛型
      参数:
      value1 - 第一个值
      value2 - 第二个值
      返回:
      true yes, false no
    • equalsNotNull

      public static <T> boolean equalsNotNull(T value1, T value2)
      判断两个值是否一样 ( 非 null 判断 )
      类型参数:
      T - 泛型
      参数:
      value1 - 第一个值
      value2 - 第二个值
      返回:
      true yes, false no
    • equalsIgnoreCase

      public static boolean equalsIgnoreCase(String value1, String value2)
      判断两个值是否一样 ( 忽略大小写 )
      参数:
      value1 - 第一个值
      value2 - 第二个值
      返回:
      true yes, false no
    • equalsIgnoreCaseNotNull

      public static boolean equalsIgnoreCaseNotNull(String value1, String value2)
      判断两个值是否一样 ( 忽略大小写 )
      参数:
      value1 - 第一个值
      value2 - 第二个值
      返回:
      true yes, false no
    • isEquals

      public static boolean isEquals(String... args)
      判断多个字符串是否相等, 只有全相等才返回 true ( 对比大小写 )
      参数:
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isEquals

      public static boolean isEquals(boolean isIgnore, String... args)
      判断多个字符串是否相等, 只有全相等才返回 true
      参数:
      isIgnore - 是否忽略大小写
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isOrEquals

      public static boolean isOrEquals(String str, String... args)
      判断多个字符串, 只要有一个符合条件则通过
      参数:
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isOrEquals

      public static boolean isOrEquals(boolean isIgnore, String str, String... args)
      判断多个字符串, 只要有一个符合条件则通过
      参数:
      isIgnore - 是否忽略大小写
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isContains

      public static boolean isContains(String str, String... args)
      判断一堆值中, 是否存在符合该条件的 ( 包含 )
      参数:
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isContains

      public static boolean isContains(boolean isIgnore, String str, String... args)
      判断一堆值中, 是否存在符合该条件的 ( 包含 )
      参数:
      isIgnore - 是否忽略大小写
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isStartsWith

      public static boolean isStartsWith(String str, String... args)
      判断内容, 是否属于特定字符串开头 ( 对比大小写 )
      参数:
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isStartsWith

      public static boolean isStartsWith(boolean isIgnore, String str, String... args)
      判断内容, 是否属于特定字符串开头
      参数:
      isIgnore - 是否忽略大小写
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isEndsWith

      public static boolean isEndsWith(String str, String... args)
      判断内容, 是否属于特定字符串结尾 ( 对比大小写 )
      参数:
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • isEndsWith

      public static boolean isEndsWith(boolean isIgnore, String str, String... args)
      判断内容, 是否属于特定字符串结尾
      参数:
      isIgnore - 是否忽略大小写
      str - 待校验的字符串
      args - 待校验的字符串数组
      返回:
      true yes, false no
    • countMatches

      public static int countMatches(String str, String keyword)
      统计字符串匹配个数
      参数:
      str - 待匹配字符串
      keyword - 匹配 key
      返回:
      字符串 key 匹配个数
    • countMatches2

      public static int countMatches2(String str, String keyword)
      统计字符串匹配个数
      参数:
      str - 待匹配字符串
      keyword - 匹配 key
      返回:
      字符串 key 匹配个数
    • isSpace

      public static boolean isSpace(CharSequence str)
      判断字符串是否为 null 或全为空白字符
      参数:
      str - 待校验字符串
      返回:
      true yes, false no
    • getBytes

      public static byte[] getBytes(String str)
      字符串 转 byte[]
      参数:
      str - 待处理字符串
      返回:
      byte[]
    • clearSpace

      public static String clearSpace(String str)
      清空字符串全部空格
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearTab

      public static String clearTab(String str)
      清空字符串全部 Tab
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearLine

      public static String clearLine(String str)
      清空字符串全部换行符
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearLine2

      public static String clearLine2(String str)
      清空字符串全部换行符
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearSpaceTrim

      public static String clearSpaceTrim(String str)
      清空字符串前后全部空格
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearTabTrim

      public static String clearTabTrim(String str)
      清空字符串前后全部 Tab
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearLineTrim

      public static String clearLineTrim(String str)
      清空字符串前后全部换行符
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearLineTrim2

      public static String clearLineTrim2(String str)
      清空字符串前后全部换行符
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearSpaceTabLine

      public static String clearSpaceTabLine(String str)
      清空字符串全部空格、Tab、换行符
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • clearSpaceTabLineTrim

      public static String clearSpaceTabLineTrim(String str)
      清空字符串前后全部空格、Tab、换行符
      参数:
      str - 待处理字符串
      返回:
      处理后的字符串
    • appendSpace

      public static String appendSpace(int number)
      追加空格
      参数:
      number - 空格数量
      返回:
      指定数量的空格字符串
    • appendTab

      public static String appendTab(int number)
      追加 Tab
      参数:
      number - tab 键数量
      返回:
      指定数量的 Tab 字符串
    • appendLine

      public static String appendLine(int number)
      追加换行
      参数:
      number - 换行数量
      返回:
      指定数量的换行字符串
    • appendLine2

      public static String appendLine2(int number)
      追加换行
      参数:
      number - 换行数量
      返回:
      指定数量的换行字符串
    • forString

      public static String forString(int number, String str)
      循环指定数量字符串
      参数:
      number - 空格数量
      str - 待追加字符串
      返回:
      指定数量字符串
    • joinArgs

      public static String joinArgs(Object delimiter, Object... values)
      循环拼接
      参数:
      delimiter - 拼接符号
      values - 待拼接对象
      返回:
      拼接后的值
    • join

      public static String join(Object delimiter, Object[] values)
      循环拼接
      参数:
      delimiter - 拼接符号
      values - 待拼接对象
      返回:
      拼接后的值
    • join

      public static String join(Object delimiter, Iterable iterable)
      循环拼接
      参数:
      delimiter - 拼接符号
      iterable - 待拼接对象
      返回:
      拼接后的值
    • colonSplit

      public static String colonSplit(String str)
      冒号分割处理
      参数:
      str - 待处理字符串
      返回:
      冒号分割后的字符串
    • getString

      public static String getString(String str)
      获取字符串 ( 判 null )
      参数:
      str - 待校验的字符串
      返回:
      校验后的字符串
    • getString

      public static String getString(String str, String defaultStr)
      获取字符串 ( 判 null )
      参数:
      str - 待校验的字符串
      defaultStr - 默认字符串
      返回:
      校验后的字符串
    • getString

      public static String getString(Object object)
      获取字符串 ( 判 null )
      参数:
      object - 待校验的对象
      返回:
      校验后的字符串
    • getString

      public static String getString(Object object, String defaultStr)
      获取字符串 ( 判 null )
      参数:
      object - 待校验的对象
      defaultStr - 默认字符串
      返回:
      校验后的字符串
    • checkValue

      public static String checkValue(String str)
      检查字符串
      参数:
      str - 待校验字符串
      返回:
      如果待校验字符串为 null, 则返回默认字符串, 如果不为 null, 则返回该字符串
    • checkValue

      public static String checkValue(String defaultStr, String str)
      检查字符串
      参数:
      defaultStr - 默认字符串
      str - 待校验字符串
      返回:
      如果待校验字符串为 null, 则返回 defaultStr, 如果不为 null, 则返回该字符串
    • checkValue

      public static String checkValue(String defaultStr, String value1, String value2)
      检查字符串 ( 单独检查两个值 )
      参数:
      defaultStr - 默认字符串
      value1 - 第一个待校验字符串
      value2 - 第二个待校验字符串
      返回:
      两个待校验字符串中不为 null 的字符串, 如果都为 null, 则返回 defaultStr
    • checkValues

      public static String checkValues(String defaultStr, String... args)
      检查字符串 ( 多个值 )
      参数:
      defaultStr - 默认字符串
      args - 待校验字符串数组
      返回:
      字符串数组中不为 null 的字符串, 如果都为 null, 则返回 defaultStr
    • checkValuesSpace

      public static String checkValuesSpace(String defaultStr, String... args)
      检查字符串 ( 多个值, 删除前后空格对比判断 )
      参数:
      defaultStr - 默认字符串
      args - 待校验字符串数组
      返回:
      字符串数组中不为 null 的字符串, 如果都为 null, 则返回 defaultStr
    • format

      public static String format(String format, Object... args)
      字符串格式化
      参数:
      format - 待格式化字符串
      args - 格式化参数
      返回:
      格式化后的字符串
    • argsFormat

      public static String argsFormat(Object... args)
      根据可变参数数量自动格式化
      参数:
      args - 格式化参数
      返回:
      格式化后的字符串
    • concat

      public static String concat(Object... args)
      字符串连接, 将参数列表拼接为一个字符串
      参数:
      args - 追加数据
      返回:
      拼接后的字符串
    • concatSpiltWith

      public static String concatSpiltWith(String split, Object... args)
      字符串连接, 将参数列表拼接为一个字符串
      参数:
      split - 追加间隔
      args - 追加数据
      返回:
      拼接后的字符串
    • concatSpiltWithIgnoreLast

      public static String concatSpiltWithIgnoreLast(String split, Object... args)
      字符串连接, 将参数列表拼接为一个字符串 ( 最后一个不追加间隔 )
      参数:
      split - 追加间隔
      args - 追加数据
      返回:
      拼接后的字符串
    • appends

      public static StringBuilder appends(StringBuilder builder, String split, Object... args)
      StringBuilder 拼接处理
      参数:
      builder - 拼接 Builder
      split - 追加间隔
      args - 拼接数据源
      返回:
      StringBuilder
    • appendsIgnoreLast

      public static StringBuilder appendsIgnoreLast(StringBuilder builder, String split, Object... args)
      StringBuilder 拼接处理 ( 最后一个不追加间隔 )
      参数:
      builder - 拼接 Builder
      split - 追加间隔
      args - 拼接数据源
      返回:
      StringBuilder
    • gbkEncode

      public static String gbkEncode(String str)
      字符串进行 GBK 编码
      参数:
      str - 待处理字符串
      返回:
      GBK 编码后的字符串
    • gbk2312Encode

      public static String gbk2312Encode(String str)
      字符串进行 GBK2312 编码
      参数:
      str - 待处理字符串
      返回:
      GBK2312 编码后的字符串
    • utf8Encode

      public static String utf8Encode(String str)
      字符串进行 UTF-8 编码
      参数:
      str - 待处理字符串
      返回:
      UTF-8 编码后的字符串
    • strEncode

      public static String strEncode(String str, String enc)
      进行字符串编码
      参数:
      str - 待处理字符串
      enc - 编码格式
      返回:
      指定编码格式编码后的字符串
    • urlEncode

      public static String urlEncode(String str)
      进行 URL 编码, 默认 UTF-8
      参数:
      str - 待处理字符串
      返回:
      UTF-8 编码格式 URL 编码后的字符串
    • urlEncode

      public static String urlEncode(String str, String enc)
      进行 URL 编码
      参数:
      str - 待处理字符串
      enc - 编码格式
      返回:
      指定编码格式 URL 编码后的字符串
    • urlDecode

      public static String urlDecode(String str)
      进行 URL 解码, 默认 UTF-8
      参数:
      str - 待处理字符串
      返回:
      UTF-8 编码格式 URL 解码后的字符串
    • urlDecode

      public static String urlDecode(String str, String enc)
      进行 URL 解码
      参数:
      str - 待处理字符串
      enc - 解码格式
      返回:
      指定编码格式 URL 解码后的字符串
    • urlDecodeWhile

      public static String urlDecodeWhile(String str, int threshold)
      进行 URL 解码, 默认 UTF-8 ( 循环到非 URL 编码为止 )
      参数:
      str - 待处理字符串
      threshold - 解码次数阈值, 超过该次数还未完成则直接返回
      返回:
      UTF-8 编码格式 URL 解码后的字符串
    • urlDecodeWhile

      public static String urlDecodeWhile(String str, String enc, int threshold)
      进行 URL 解码 ( 循环到非 URL 编码为止 )
      参数:
      str - 待处理字符串
      enc - 解码格式
      threshold - 解码次数阈值, 超过该次数还未完成则直接返回
      返回:
      指定编码格式 URL 解码后的字符串
    • ascii

      public static String ascii(String str)
      将字符串转移为 ASCII 码
      参数:
      str - 待处理字符串
      返回:
      字符串转 ASCII 码后的字符串
    • unicode

      public static String unicode(String str)
      将字符串转移为 Unicode 码
      参数:
      str - 待处理字符串
      返回:
      字符串转 Unicode 码后的字符串
    • unicodeString

      public static String unicodeString(char[] chars)
      将字符数组转移为 Unicode 码
      参数:
      chars - char[]
      返回:
      char[] 转 Unicode 码后的字符串
    • dbc

      public static String dbc(String str)
      转化为半角字符
      参数:
      str - 待处理字符串
      返回:
      转换半角字符串
    • sbc

      public static String sbc(String str)
      转化为全角字符 如: a = a, A = A
      参数:
      str - 待处理字符串
      返回:
      转换全角字符串
    • checkChineseToString

      public static boolean checkChineseToString(String str)
      检测字符串是否全是中文
      参数:
      str - 待校验字符串
      返回:
      true yes, false no
    • isChinese

      public static boolean isChinese(char ch)
      判断输入汉字
      参数:
      ch - 待校验字符
      返回:
      true yes, false no
    • upperFirstLetter

      public static String upperFirstLetter(String str)
      首字母大写
      参数:
      str - 待处理字符串
      返回:
      首字母大写字符串
    • lowerFirstLetter

      public static String lowerFirstLetter(String str)
      首字母小写
      参数:
      str - 待处理字符串
      返回:
      首字母小写字符串
    • reverse

      public static String reverse(String str)
      反转字符串
      参数:
      str - 待处理字符串
      返回:
      反转字符串
    • underScoreCaseToCamelCase

      public static String underScoreCaseToCamelCase(String str)
      下划线命名转为驼峰命名
      参数:
      str - 下划线命名格式字符串
      返回:
      驼峰命名格式字符串
    • camelCaseToUnderScoreCase

      public static String camelCaseToUnderScoreCase(String str)
      驼峰命名法转为下划线命名
      参数:
      str - 驼峰命名格式字符串
      返回:
      下划线命名格式字符串
    • sqliteEscape

      public static String sqliteEscape(String str)
      字符串数据库字符转义
      参数:
      str - 待处理字符串
      返回:
      转义处理后的字符串
    • convertHideMobile

      public static String convertHideMobile(String phone)
      转换手机号
      参数:
      phone - 待处理字符串
      返回:
      处理后的字符串
    • convertHideMobile

      public static String convertHideMobile(String phone, String symbol)
      转换手机号
      参数:
      phone - 待处理字符串
      symbol - 转换符号
      返回:
      处理后的字符串
    • convertSymbolHide

      public static String convertSymbolHide(int start, String str, String symbol)
      转换符号处理
      参数:
      start - 开始位置
      str - 待处理字符串
      symbol - 转换符号
      返回:
      处理后的字符串
    • subEllipsize

      public static String subEllipsize(int maxLength, String str, String symbol)
      裁剪超出的内容, 并且追加符号 ( 如 ... )
      参数:
      maxLength - 允许最大的长度
      str - 待处理字符串
      symbol - 转换符号
      返回:
      处理后的字符串
    • subSymbolHide

      public static String subSymbolHide(int start, int symbolNumber, String str, String symbol)
      裁剪符号处理
      参数:
      start - 开始位置
      symbolNumber - 转换数量
      str - 待处理字符串
      symbol - 转换符号
      返回:
      处理后的字符串
    • subSetSymbol

      public static String subSetSymbol(String str, int frontRetainLength, int rearRetainLength, String symbol)
      裁剪内容 ( 设置符号处理 )
      参数:
      str - 待处理字符串
      frontRetainLength - 前面保留的长度
      rearRetainLength - 后面保留的长度
      symbol - 转换符号
      返回:
      处理后的字符串
    • substring

      public static String substring(String str, int endIndex)
      裁剪字符串
      参数:
      str - 待裁剪字符串
      endIndex - 结束裁剪的位置
      返回:
      裁剪后的字符串
    • substring

      public static String substring(String str, int endIndex, boolean isReturn)
      裁剪字符串
      参数:
      str - 待裁剪字符串
      endIndex - 结束裁剪的位置
      isReturn - 开始位置超过限制是否返回内容
      返回:
      裁剪后的字符串
    • substring

      public static String substring(String str, int beginIndex, int endIndex, boolean isReturn)
      裁剪字符串
      参数:
      str - 待裁剪字符串
      beginIndex - 开始裁剪的位置
      endIndex - 结束裁剪的位置
      isReturn - 开始位置超过限制是否返回内容
      返回:
      裁剪后的字符串
    • replaceSEWith

      public static String replaceSEWith(String str, String suffix)
      替换特定字符串开头、结尾的字符串 如 _____a_a_a_a_____ 传入 _ 等于 ____a_a_a_a____
      参数:
      str - 待处理字符串
      suffix - 替换符号字符串
      返回:
      处理后的字符串
    • replaceSEWith

      public static String replaceSEWith(String str, String suffix, String replace)
      替换特定字符串开头、结尾的字符串 如 _____a_a_a_a_____ 传入 _, c 等于 c____a_a_a_a____c
      参数:
      str - 待处理字符串
      suffix - 替换匹配内容
      replace - 替换的内容
      返回:
      处理后的字符串
    • replaceStartsWith

      public static String replaceStartsWith(String str, String prefix)
      替换开头字符串
      参数:
      str - 待处理字符串
      prefix - 开头匹配字符串
      返回:
      处理后的字符串
    • replaceStartsWith

      public static String replaceStartsWith(String str, String prefix, String startAppend)
      替换开头字符串
      参数:
      str - 待处理字符串
      prefix - 开头匹配字符串
      startAppend - 开头追加的内容
      返回:
      处理后的字符串
    • replaceEndsWith

      public static String replaceEndsWith(String str, String suffix)
      替换结尾字符串
      参数:
      str - 待处理字符串
      suffix - 结尾匹配字符串
      返回:
      处理后的字符串
    • replaceEndsWith

      public static String replaceEndsWith(String str, String suffix, String replace)
      替换结尾字符串
      参数:
      str - 待处理字符串
      suffix - 结尾匹配字符串
      replace - 替换的内容
      返回:
      处理后的字符串
    • clearSEWiths

      public static String clearSEWiths(String str, String suffix)
      清空特定字符串开头、结尾的字符串 如 _____a_a_a_a_____ 传入 _ 等于 a_a_a_a
      参数:
      str - 待处理字符串
      suffix - 匹配判断字符串
      返回:
      处理后的字符串
    • clearStartsWith

      public static String clearStartsWith(String str, String suffix)
      清空特定字符串开头的字符串 如 _____a_a_a_a_____ 传入 _ 等于 a_a_a_a_____
      参数:
      str - 待处理字符串
      suffix - 匹配判断字符串
      返回:
      处理后的字符串
    • clearEndsWith

      public static String clearEndsWith(String str, String suffix)
      清空特定字符串结尾的字符串 如 _____a_a_a_a_____ 传入 _ 等于 _____a_a_a_a
      参数:
      str - 待处理字符串
      suffix - 匹配判断字符串
      返回:
      处理后的字符串
    • replaceAll

      public static String replaceAll(String str, String suffix, String replace)
      替换字符串
      参数:
      str - 待处理字符串
      suffix - 匹配判断字符串
      replace - 替换的内容
      返回:
      处理后的字符串
    • replaceAllToNull

      public static String replaceAllToNull(String str, String suffix, String replace)
      替换字符串
      参数:
      str - 待处理字符串
      suffix - 匹配判断字符串
      replace - 替换的内容
      返回:
      处理后的字符串, 替换失败则返回 null
    • replaceAlls

      public static String replaceAlls(String str, String[] suffixArrays, String[] replaceArrays)
      替换字符串
      参数:
      str - 待处理字符串
      suffixArrays - 匹配判断字符串数组
      replaceArrays - 准备替换的字符串数组
      返回:
      处理后的字符串
    • split

      public static String[] split(String str, String regex)
      拆分字符串
      参数:
      str - 待处理字符串
      regex - 正则表达式
      返回:
      拆分后的数组
    • split

      public static String split(String str, String regex, int index)
      拆分字符串获取指定索引
      参数:
      str - 待处理字符串
      regex - 正则表达式
      index - 索引
      返回:
      拆分后的数组
    • split

      public static String split(String str, String regex, int index, String defaultStr)
      拆分字符串获取指定索引
      参数:
      str - 待处理字符串
      regex - 正则表达式
      index - 索引
      defaultStr - 默认字符串
      返回:
      拆分后的数组