类 StringUtil


  • public class StringUtil
    extends Object
    版本:
    2021年9月29日
    作者:
    王鸿雁
    • 构造器详细资料

      • StringUtil

        public StringUtil()
    • 方法详细资料

      • success

        public static boolean success​(String str)
      • notSuccess

        public static boolean notSuccess​(String str)
      • isNotEmpty

        public static boolean isNotEmpty​(String str)
      • isAllEmpty

        public static boolean isAllEmpty​(String... str)
      • isNotEmpty

        public static boolean isNotEmpty​(String... str)
      • isEmpty

        public static boolean isEmpty​(String str)
      • isEmpty

        public static boolean isEmpty​(String... str)
      • genGUID

        public static String genGUID()
      • doScattered

        public static List<String> doScattered​(String str,
                                               int len)
      • genHeadPicDiv

        public static String genHeadPicDiv​(String str)
      • isMobileNumber

        public static boolean isMobileNumber​(String mobile)
        参数:
        mobile - 手机号码?
        返回:
        true
      • randomNumber

        public static String randomNumber​(int len)
        参数:
        len - 随机的数字字符串
        返回:
        随机的数字字符串
      • sha1

        public static String sha1​(String str)
        参数:
        str - sha1加密
        返回:
        sha1加密
      • random

        public static String random​(int len)
      • isNumber

        public static boolean isNumber​(String str)
      • isFloat

        public static boolean isFloat​(String str)
      • endSubstring

        public static String endSubstring​(String str,
                                          int len)
      • hasEmpty

        public static boolean hasEmpty​(String... str)
      • toInt

        public static int toInt​(String str)
        参数:
        str - 字符串转成数字,如果为空则返回0
        返回:
        字符串转成数字,如果为空则返回0
      • concatComma

        public static String concatComma​(String... strs)
      • tryLuck

        public static char tryLuck​(String luckStr)
        参数:
        luckStr - 试试运行
        返回:
        试试运行
      • getMacAddress

        public static String getMacAddress()
        返回:
        获得本机的MAC地址
      • base64Encode

        public static String base64Encode​(String str)
      • base64Decode

        public static String base64Decode​(String str)
      • coalesceEmpty

        public static String coalesceEmpty​(String str)
         StringUtil.coalesceEmpty(null)                = ""
         StringUtil.coalesceEmpty("")                  = "" 
         StringUtil.coalesceEmpty(" ")                 = " " 
         StringUtil.coalesceEmpty(" a ")               = " a "
         
        参数:
        str -
        返回:
      • genShortGUID

        public static String genShortGUID()
        返回:
        生成8位数短GUID,通过32位GUID转化而来,谨慎重复,必要的时候请加前缀来减少重复机率
      • substring

        public static String substring​(String str,
                                       int len)