public final class StringUtils extends Object
字符串工具类
Description:提供空值判断、字符串截取和获取字符串长度等功能.
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
isBlank(CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
|
static boolean |
isEmpty(CharSequence cs)
Checks if a CharSequence is empty ("") or null.
|
static boolean |
isNotBlank(CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace
only.
|
static boolean |
isNotEmpty(CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
|
static int |
length(CharSequence cs)
Gets a CharSequence length or
0 if the CharSequence is
null. |
static String |
substring(String str,
int start)
Intercept a CharSequence base on String.
|
static String |
substring(String str,
int start,
int end)
Intercept a CharSequence base on String.
|
static String |
trim(String str)
Remove the Spaces before and after.
|
static String |
trimToEmpty(String str)
Remove the Spaces before and after,if null,return empty.
|
static String |
trimToNull(String str)
Remove the Spaces before and after,if empty, return null.
|
public static boolean isEmpty(CharSequence cs)
Checks if a CharSequence is empty ("") or null.
public static boolean isNotEmpty(CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
public static boolean isBlank(CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
public static boolean isNotBlank(CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
public static String trimToNull(String str)
Remove the Spaces before and after,if empty, return null.
public static String trimToEmpty(String str)
Remove the Spaces before and after,if null,return empty.
public static String substring(String str, int start)
Intercept a CharSequence base on String.
public static String substring(String str, int start, int end)
Intercept a CharSequence base on String.
public static int length(CharSequence cs)
0 if the CharSequence is
null.Copyright © 2016. All rights reserved.