Mica 官方网站

vuePress-theme-reco 如梦技术    2021
Mica 官方网站
文档
组件集
VIP
博文
友情链接
关于
GitHub

如梦技术

0

Article

9

Tag

文档
组件集
VIP
博文
友情链接
关于
GitHub
  • 认识 Mica

    • Mica 简介
    • 快速开始
    • 发行版本
  • mica工具类

    • mica-core模块说明
    • $工具集
    • SystemCode
    • ServiceException
    • Bean-validator分组
    • StringUtil
    • SystemUtil
    • BeanUtil
    • FileUtil
    • JsonUtil
    • UrlUtil
    • WebUtil
    • INetUtil
    • IoUtil
    • NumberUtil
    • ConvertUtil
    • ThreadUtil
    • PathUtil
    • HexUtil
    • AesUtil
    • DesUtil
    • RsaUtil
    • Base64Util
    • DigestUtil
    • DateUtil
    • ObjectUtil
    • ResourceUtil
    • ThreadLocalUtil
    • RuntimeUtil
    • ReflectUtil
    • ClassUtil
    • CollectionUtil
    • Unchecked(Lambda受检异常)
    • Exceptions
    • DecimalNum
    • Once
    • CountMap
    • Version
    • xpath解析xml

vuePress-theme-reco 如梦技术    2021

继承自Spring util的工具类,减少jar依赖


如梦技术

# 继承自Spring util的工具类,减少jar依赖

类名: StringUtil

# firstCharToLower

/**
 * 首字母变小写
 *
 * @param str 字符串
 * @return {String}
 */
StringUtil.firstCharToLower(String str);

# firstCharToUpper

/**
 * 首字母变大写
 *
 * @param str 字符串
 * @return {String}
 */
StringUtil.firstCharToUpper(String str);

# isBlank

/**
 * Check whether the given {@code CharSequence} contains actual <em>text</em>.
 * <p>More specifically, this method returns {@code true} if the
 * {@code CharSequence} is not {@code null}, its length is greater than
 * 0, and it contains at least one non-whitespace character.
 * <pre class="code">
 * StringUtil.isBlank(null) = true
 * StringUtil.isBlank("") = true
 * StringUtil.isBlank(" ") = true
 * StringUtil.isBlank("12345") = false
 * StringUtil.isBlank(" 12345 ") = false
 * </pre>
 *
 * @param cs the {@code CharSequence} to check (may be {@code null})
 * @return {@code true} if the {@code CharSequence} is not {@code null},
 * its length is greater than 0, and it does not contain whitespace only
 * @see Character#isWhitespace
 */
StringUtil.isBlank(CharSequence cs);

# isNotBlank

/**
 * <p>Checks if a CharSequence is not empty (""), not null and not whitespace only.</p>
 * <pre>
 * StringUtil.isNotBlank(null)	  = false
 * StringUtil.isNotBlank("")		= false
 * StringUtil.isNotBlank(" ")	   = false
 * StringUtil.isNotBlank("bob")	 = true
 * StringUtil.isNotBlank("  bob  ") = true
 * </pre>
 *
 * @param cs the CharSequence to check, may be null
 * @return {@code true} if the CharSequence is
 * not empty and not null and not whitespace
 * @see Character#isWhitespace
 */
StringUtil.isNotBlank(CharSequence cs);

# isAnyBlank

/**
 * 有 任意 一个 Blank
 *
 * @param css CharSequence
 * @return boolean
 */
StringUtil.isAnyBlank(CharSequence css);

# isAnyBlank

/**
 * 有 任意 一个 Blank
 *
 * @param css CharSequence
 * @return boolean
 */
StringUtil.isAnyBlank(Collection<CharSequence> css);

# isNoneBlank

/**
 * 是否全非 Blank
 *
 * @param css CharSequence
 * @return boolean
 */
StringUtil.isNoneBlank(CharSequence css);

# isNoneBlank

/**
 * 是否全非 Blank
 *
 * @param css CharSequence
 * @return boolean
 */
StringUtil.isNoneBlank(Collection<CharSequence> css);

# isAnyNotBlank

/**
 * 有 任意 一个 Blank
 *
 * @param css CharSequence
 * @return boolean
 */
StringUtil.isAnyNotBlank(CharSequence css);

# isAnyNotBlank

/**
 * 有 任意 一个 Blank
 *
 * @param css CharSequence
 * @return boolean
 */
StringUtil.isAnyNotBlank(Collection<CharSequence> css);

# isNumeric

/**
 * 判断一个字符串是否是数字
 *
 * @param cs the CharSequence to check, may be null
 * @return {boolean}
 */
StringUtil.isNumeric(CharSequence cs);

# format

/**
 * 将字符串中特定模式的字符转换成map中对应的值
 * <p>
 * use: format("my name is ${name}, and i like ${like}!", {"name":"L.cm", "like": "Java"})
 *
 * @param message 需要转换的字符串
 * @param params  转换所需的键值对集合
 * @return 转换后的字符串
 */
StringUtil.format(String message, Map<String,Object> params);

# format

/**
 * 同 log 格式的 format 规则
 * <p>
 * use: format("my name is {}, and i like {}!", "L.cm", "Java")
 *
 * @param message   需要转换的字符串
 * @param arguments 需要替换的变量
 * @return 转换后的字符串
 */
StringUtil.format(String message, Object arguments);

# join

/**
 * Convert a {@code Collection} into a delimited {@code String} (e.g., CSV).
 * <p>Useful for {@code toString()} implementations.
 *
 * @param coll the {@code Collection} to convert
 * @return the delimited {@code String}
 */
StringUtil.join(Collection<?> coll);

# join

/**
 * Convert a {@code Collection} into a delimited {@code String} (e.g. CSV).
 * <p>Useful for {@code toString()} implementations.
 *
 * @param coll  the {@code Collection} to convert
 * @param delim the delimiter to use (typically a ",")
 * @return the delimited {@code String}
 */
StringUtil.join(Collection<?> coll, String delim);

# join

/**
 * Convert a {@code String} array into a comma delimited {@code String}
 * (i.e., CSV).
 * <p>Useful for {@code toString()} implementations.
 *
 * @param arr the array to display
 * @return the delimited {@code String}
 */
StringUtil.join(Object[] arr);

# join

/**
 * Convert a {@code String} array into a delimited {@code String} (e.g. CSV).
 * <p>Useful for {@code toString()} implementations.
 *
 * @param arr   the array to display
 * @param delim the delimiter to use (typically a ",")
 * @return the delimited {@code String}
 */
StringUtil.join(Object[] arr, String delim);

# split

/**
 * 分割 字符串
 *
 * @param str       字符串
 * @param delimiter 分割符
 * @return 字符串数组
 */
StringUtil.split(String str, String delimiter);

# splitTrim

/**
 * 分割 字符串 删除常见 空白符
 *
 * @param str       字符串
 * @param delimiter 分割符
 * @return 字符串数组
 */
StringUtil.splitTrim(String str, String delimiter);

# simpleMatch

/**
 * 字符串是否符合指定的 表达式
 *
 * <p>
 * pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
 * </p>
 *
 * @param pattern 表达式
 * @param str     字符串
 * @return 是否匹配
 */
StringUtil.simpleMatch(String pattern, String str);

# simpleMatch

/**
 * 字符串是否符合指定的 表达式
 *
 * <p>
 * pattern styles: "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
 * </p>
 *
 * @param patterns 表达式 数组
 * @param str      字符串
 * @return 是否匹配
 */
StringUtil.simpleMatch(String[] patterns, String str);

# getUUID

/**
 * 生成uuid,采用 jdk 9 的形式,优化性能
 *
 * @return UUID
 */
StringUtil.getUUID();

# escapeHtml

/**
 * 转义HTML用于安全过滤
 *
 * @param html html
 * @return {String}
 */
StringUtil.escapeHtml(String html);

# cleanText

/**
 * 清理字符串,清理出某些不可见字符和一些sql特殊字符
 *
 * @param txt 文本
 * @return {String}
 */
StringUtil.cleanText(String txt);

# cleanIdentifier

/**
 * 获取标识符,用于参数清理
 *
 * @param param 参数
 * @return 清理后的标识符
 */
StringUtil.cleanIdentifier(String param);

# random

/**
 * 随机数生成
 *
 * @param count 字符长度
 * @return 随机数
 */
StringUtil.random(int count);

# random

/**
 * 随机数生成
 *
 * @param count      字符长度
 * @param randomType 随机数类别
 * @return 随机数
 */
StringUtil.random(int count, RandomType randomType);

# 微信 vs 公众号

如梦技术

精彩内容每日推荐!!!

编辑此页面
更新时间: 9/8/2020, 8:42:56 PM
  • firstCharToLower
  • firstCharToUpper
  • isBlank
  • isNotBlank
  • isAnyBlank
  • isAnyBlank
  • isNoneBlank
  • isNoneBlank
  • isAnyNotBlank
  • isAnyNotBlank
  • isNumeric
  • format
  • format
  • join
  • join
  • join
  • join
  • split
  • splitTrim
  • simpleMatch
  • simpleMatch
  • getUUID
  • escapeHtml
  • cleanText
  • cleanIdentifier
  • random
  • random
  • 微信 vs 公众号