类 StringUtils

java.lang.Object
cn.lonelysnow.generator.utils.StringUtils

public class StringUtils extends Object
  • 字段详细资料

  • 构造器详细资料

    • StringUtils

      private StringUtils()
  • 方法详细资料

    • isEmpty

      public static boolean isEmpty(CharSequence cs)
      判断字符串是否为空
      参数:
      cs - 需要判断字符串
      返回:
      判断结果
    • isNotEmpty

      public static boolean isNotEmpty(CharSequence cs)
      判断字符串是否不为空
      参数:
      cs - 需要判断字符串
      返回:
      判断结果
    • matches

      public static boolean matches(String regex, String input)
      正则表达式匹配
      参数:
      regex - 正则表达式字符串
      input - 要匹配的字符串
      返回:
      如果 input 符合 regex 正则表达式格式, 返回true, 否则返回 false;
    • containsUpperCase

      public static boolean containsUpperCase(String word)
      包含大写字母
      参数:
      word - 待判断字符串
      返回:
      ignore
    • isCapitalMode

      public static boolean isCapitalMode(String word)
      是否为大写命名
      参数:
      word - 待判断字符串
      返回:
      ignore
    • isMixedMode

      public static boolean isMixedMode(String word)
      是否为驼峰下划线混合命名
      参数:
      word - 待判断字符串
      返回:
      ignore
    • endsWith

      public static boolean endsWith(String str, String suffix)
      Check if a String ends with a specified suffix.

      nulls are handled without exceptions. Two null references are considered to be equal. The comparison is case sensitive.

       StringUtils.endsWith(null, null)      = true
       StringUtils.endsWith(null, "abcdef")  = false
       StringUtils.endsWith("def", null)     = false
       StringUtils.endsWith("def", "abcdef") = true
       StringUtils.endsWith("def", "ABCDEF") = false
       

      参数:
      str - the String to check, may be null
      suffix - the suffix to find, may be null
      返回:
      true if the String ends with the suffix, case sensitive, or both null
      从以下版本开始:
      2.4
      另请参阅:
    • endsWith

      private static boolean endsWith(String str, String suffix, boolean ignoreCase)
      Check if a String ends with a specified suffix (optionally case insensitive).
      参数:
      str - the String to check, may be null
      suffix - the suffix to find, may be null
      ignoreCase - inidicates whether the compare should ignore case (case insensitive) or not.
      返回:
      true if the String starts with the prefix or both null
      另请参阅:
    • removeIsPrefixIfBoolean

      public static String removeIsPrefixIfBoolean(String propertyName, Class<?> propertyType)
      去除boolean类型is开头的字符串
      参数:
      propertyName - 字段名
      propertyType - 字段类型
    • isBoolean

      public static boolean isBoolean(Class<?> propertyCls)
      是否为Boolean类型(包含普通类型)
      参数:
      propertyCls - ignore
      返回:
      ignore
    • firstCharToLower

      public static String firstCharToLower(String rawString)
      第一个首字母小写,之后字符大小写的不变

      StringUtils.firstCharToLower( "UserService" ) = userService

      StringUtils.firstCharToLower( "UserServiceImpl" ) = userServiceImpl

      参数:
      rawString - 需要处理的字符串
      返回:
      ignore
    • prefixToLower

      public static String prefixToLower(String rawString, int index)
      前n个首字母小写,之后字符大小写的不变
      参数:
      rawString - 需要处理的字符串
      index - 多少个字符(从左至右)
      返回:
      ignore
    • camelToHyphen

      public static String camelToHyphen(String input)
      驼峰转连字符

      StringUtils.camelToHyphen( "managerAdminUserService" ) = manager-admin-user-service

      参数:
      input - ignore
      返回:
      以'-'分隔
      另请参阅:
    • wordsAndHyphenAndCamelToConstantCase

      private static String wordsAndHyphenAndCamelToConstantCase(String input)
    • shouldReplace

      private static boolean shouldReplace(char c)
    • wordsToHyphenCase

      private static String wordsToHyphenCase(String s)