StringUtils , NumberUtils 作用
来源:互联网 发布:c语言for循环执行顺序 编辑:程序博客网 时间:2024/06/03 13:59
一 .StringUtils------isEmpty , isNotEmpty , isBlank , isNotBlank
1
.
public
static
boolean
isEmpty(String str)
判断某字符串是否为空,为空的标准是 str==
null
或 str.length()==
0
下面是 StringUtils 判断是否为空的示例:
StringUtils.isEmpty(
null
) =
true
StringUtils.isEmpty(
""
) =
true
StringUtils.isEmpty(
" "
) =
false
//注意在 StringUtils 中空格作非空处理
StringUtils.isEmpty(
" "
) =
false
StringUtils.isEmpty(
"bob"
) =
false
StringUtils.isEmpty(
" bob "
) =
false
2
.
public
static
boolean
isNotEmpty(String str)
判断某字符串是否非空,等于 !isEmpty(String str)
下面是示例:
StringUtils.isNotEmpty(
null
) =
false
StringUtils.isNotEmpty(
""
) =
false
StringUtils.isNotEmpty(
" "
) =
true
StringUtils.isNotEmpty(
" "
) =
true
StringUtils.isNotEmpty(
"bob"
) =
true
StringUtils.isNotEmpty(
" bob "
) =
true
3
.
public
static
boolean
isBlank(String str)
判断某字符串是否为空或长度为
0
或由空白符(whitespace) 构成
下面是示例:
StringUtils.isBlank(
null
) =
true
StringUtils.isBlank(
""
) =
true
StringUtils.isBlank(
" "
) =
true
StringUtils.isBlank(
" "
) =
true
StringUtils.isBlank(
"\t \n \f \r"
) =
true
//对于制表符、换行符、换页符和回车符
StringUtils.isBlank()
//均识为空白符
StringUtils.isBlank(
"\b"
) =
false
//"\b"为单词边界符
StringUtils.isBlank(
"bob"
) =
false
StringUtils.isBlank(
" bob "
) =
false
4
.
public
static
boolean
isNotBlank(String str)
判断某字符串是否不为空且长度不为
0
且不由空白符(whitespace) 构成,等于 !isBlank(String str)
下面是示例:
StringUtils.isNotBlank(
null
) =
false
StringUtils.isNotBlank(
""
) =
false
StringUtils.isNotBlank(
" "
) =
false
StringUtils.isNotBlank(
" "
) =
false
StringUtils.isNotBlank(
"\t \n \f \r"
) =
false
StringUtils.isNotBlank(
"\b"
) =
true
StringUtils.isNotBlank(
"bob"
) =
true
StringUtils.isNotBlank(
" bob "
) =
true
- StringUtils , NumberUtils 作用
- StringUtils,NumberUtils
- NumberUtils
- NumberUtils
- StringUtils.hasText(字符串)的作用
- NumberUtils用法
- NumberUtils用法
- NumberUtils用法
- NumberUtils 用法
- StringUtils
- StringUtils
- StringUtils
- StringUtils
- StringUtils
- StringUtils
- StringUtils
- StringUtils
- StringUtils
- 树莓派自动连接无线
- Google Ajax Library
- Settings添加屏幕旋转功能
- FeatureLayer tooltip显示设置
- JVM中的out of memory错误原因
- StringUtils , NumberUtils 作用
- PostgreSQL与MySQL比较
- You cannot access the existing File Share resources on a Windows Server 2003 failover cluster
- hdu 1042 N!
- Android4.0加载网络图片问题
- Android 超级终端命令
- ActiveMQ5.7.0注册为windows系统服务后无法启动
- itoa 及其实现与sprintf
- hdu 3926 Hand in Hand(同构图)