public class StringUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
contain(String str,
String regex) |
static boolean |
containNumber(String str)
判读是否包含数字
|
static boolean |
containPunct(String str)
是否包含有标点符号
|
static boolean |
containUnreadableCode(String str)
判断是否包含有乱码的数据,如果字符串中包含有替换字符就认为是乱码
|
static boolean |
containWord(String str)
判断是否包含a-zA-Z_0-9
|
static int |
countMatches(String str,
String sub)
计算str中包含多少个子字符串sub
|
static String |
escapeSql(String str)
sql 查询转义
|
static String |
formatNull(String src)
出去null和""
|
static String |
getUuid() |
static boolean |
isEmpty(String input)
验证字符串是否为空
|
static boolean |
isNotEmpty(String input) |
static boolean |
isNumber(String str)
判断是否数字
|
static boolean |
isUrl(String src) |
static boolean |
overLength(String str)
判断字符串的长度
|
static String |
removeAllPunct(String str)
移除字符串中的所有的中英文标点符号
|
static String |
removeAllSpace(String text)
移除所有的空格
|
static String |
replaceAll(String input,
String regex,
String replacement)
替换所有的(不区分大小写)
|
static String |
replaceInValidateChar(String str)
将特殊符号去掉,但是保留空格
|
static String |
specialStr(String str)
字符串中含有特殊字符的处理
|
static String |
substring(String str,
int beginIndex,
int endIndex)
获得源字符串的一个子字符串
|
static Set<String> |
substring(String str,
String sub)
计算str中包含子字符串sub所在位置的前一个字符或者后一个字符和sub所组成的新字符串
|
static String[] |
toHexString(String str)
返回字符串对应的unicode编码
|
static String |
wrapXmlContent(String content)
过滤掉XML中无法解析的非法字符
|
public static boolean isEmpty(String input)
input - public static boolean isNotEmpty(String input)
public static boolean isNumber(String str)
str - public static boolean containUnreadableCode(String str)
str - public static boolean containNumber(String str)
str - public static boolean containWord(String str)
str - public static boolean containPunct(String str)
str - public static String replaceAll(String input, String regex, String replacement)
input - regex - replacement - public static int countMatches(String str, String sub)
str - sub - public static String substring(String str, int beginIndex, int endIndex)
str - :源字符串beginIndex - :开始索引(包括)endIndex - :结束索引(不包括)public static Set<String> substring(String str, String sub)
str - sub - public static String wrapXmlContent(String content)
content - public static boolean overLength(String str)
str - public static String replaceInValidateChar(String str)
str - public static String getUuid()
public static boolean isUrl(String src)
Copyright © 2018. All rights reserved.