forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.6 KiB
90 lines
2.6 KiB
5 years ago
|
package com.fanruan.api.util;
|
||
|
|
||
|
import com.fr.stable.StringUtils;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019-08-16
|
||
|
* 字符串工具类
|
||
|
*/
|
||
|
public class StringKit {
|
||
|
|
||
|
public static final String EMPTY = "";
|
||
|
public static final String BLANK = " ";
|
||
|
|
||
|
/**
|
||
|
* <p>检查一个字符串是否是空字符串</p>
|
||
|
* <p/>
|
||
|
* <pre>
|
||
|
* StringKit.isEmpty(null) = true
|
||
|
* StringKit.isEmpty("") = true
|
||
|
* StringKit.isEmpty(" ") = false
|
||
|
* StringKit.isEmpty("bob") = false
|
||
|
* StringKit.isEmpty(" bob ") = false
|
||
|
* </pre>
|
||
|
* <p/>
|
||
|
*
|
||
|
* @param text 被检查的字符串,可能为null
|
||
|
* @return 如果字符串为空或者是null则返回true,否则返回false
|
||
|
*/
|
||
|
public static boolean isEmpty(String text) {
|
||
|
return StringUtils.isEmpty(text);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* <p>检查一个字符串是否不为空字符串</p>
|
||
|
* <p/>
|
||
|
* <pre>
|
||
|
* StringKit.isNotEmpty(null) = false
|
||
|
* StringKit.isNotEmpty("") = false
|
||
|
* StringKit.isNotEmpty(" ") = true
|
||
|
* StringKit.isNotEmpty("bob") = true
|
||
|
* StringKit.isNotEmpty(" bob ") = true
|
||
|
* </pre>
|
||
|
*
|
||
|
* @param text 被检查的字符串,可能是null
|
||
|
* @return 如果字符串不为空且不是null则返回true,否则返回false
|
||
|
*/
|
||
|
public static boolean isNotEmpty(String text) {
|
||
|
return StringUtils.isNotEmpty(text);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* <p>检查一个字符串是否为空白字符串</p>
|
||
|
* <p/>
|
||
|
* <pre>
|
||
|
* StringKit.isBlank(null) = true
|
||
|
* StringKit.isBlank("") = true
|
||
|
* StringKit.isBlank(" ") = true
|
||
|
* StringKit.isBlank("bob") = false
|
||
|
* StringKit.isBlank(" bob ") = false
|
||
|
* </pre>
|
||
|
*
|
||
|
* @param text 被检查的字符串
|
||
|
* @return 如果字符串为空、空格符或者null那么返回true,否则返回false
|
||
|
*/
|
||
|
public static boolean isBlank(String text) {
|
||
|
return StringUtils.isBlank(text);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* <p>检查一个字符串是否不是空白字符串</p>
|
||
|
* <p/>
|
||
|
* <pre>
|
||
|
* StringKit.isNotBlank(null) = false
|
||
|
* StringKit.isNotBlank("") = false
|
||
|
* StringKit.isNotBlank(" ") = false
|
||
|
* StringKit.isNotBlank("bob") = true
|
||
|
* StringKit.isNotBlank(" bob ") = true
|
||
|
* </pre>
|
||
|
*
|
||
|
* @param text 被检查的字符串
|
||
|
* @return 如果字符串不是空字符串、空格符以及null那么就返回true,否则返回false
|
||
|
*/
|
||
|
public static boolean isNotBlank(String text) {
|
||
|
return StringUtils.isNotBlank(text);
|
||
|
}
|
||
|
|
||
|
}
|