public class Spells extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsChinese(String s)
是否包含中文
|
static int |
getChineseLength(String s)
获取一个字符串中中文字符的个数
|
static String |
getFirstSpell(String s)
获取汉字串拼音首字母, 英文字符不变
|
static String |
getFullSpell(String s)
将字符串中的中文转化为拼音, 其他字符不变 有声调
|
static String |
getSpell(String s)
将字符串中的中文转化为拼音, 其他字符不变
|
static boolean |
isAllChinese(String s)
是否全为中文 包括空格
|
static boolean |
isChinese(char c)
判断是否是中文
|
static boolean |
isChineseByName(String s)
通过 InCJK 正则
判断字符串是否是中文
只能判断部分CJK字符
|
static boolean |
isChineseByReg(String s)
通过unicode正则
判断字符串是否是中文
只能判断部分CJK字符
|
static boolean |
isMessyCode(String s)
判断是否是乱码
|
public static String getSpell(String s)
s
- 中文public static String getFirstSpell(String s)
s
- 汉字public static String getFullSpell(String s)
s
- 汉字串public static boolean isChineseByReg(String s)
s
- ignorepublic static boolean isChineseByName(String s)
s
- ignorepublic static boolean containsChinese(String s)
s
- spublic static boolean isAllChinese(String s)
s
- spublic static boolean isChinese(char c)
c
- char字符public static int getChineseLength(String s)
s
- ignorepublic static boolean isMessyCode(String s)
s
- ignoreCopyright © 2024. All rights reserved.