|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.hankcs.hanlp.utility.TextUtility
public class TextUtility
文本工具类
| 字段摘要 | |
|---|---|
static int |
CT_CHINESE
中文字符 |
static int |
CT_DELIMITER
分隔符"! |
static int |
CT_INDEX
序号 |
static int |
CT_LETTER
字母 |
static int |
CT_NUM
数字 |
static int |
CT_OTHER
其他 |
static int |
CT_SINGLE
单字节 |
| 构造方法摘要 | |
|---|---|
TextUtility()
|
|
| 方法摘要 | |
|---|---|
static int |
charType(char c)
|
static int |
charType(String str)
判断字符类型 |
static int |
cint(String str)
把表示数字含义的字符串转你成整形 |
static int |
count(String keyword,
String srcText)
统计 keyword 在 srcText 中的出现次数 |
static String |
exceptionToString(Exception e)
将异常转为字符串 |
static int |
getCharCount(String charSet,
String word)
得到字符集的字符在字符串中出现的次数 |
static int |
getUnsigned(byte b)
获取字节对应的无符号整型数 |
static boolean |
isAllChinese(String str)
是否全是中文 |
static boolean |
isAllChineseNum(String word)
是否全是中国数字 |
static boolean |
isAllDelimiter(byte[] sString)
是否全是分隔符 |
static boolean |
isAllIndex(byte[] sString)
是否全是序号 |
static boolean |
isAllLetter(String text)
是否全为英文 |
static boolean |
isAllLetterOrNum(String text)
是否全为英文或字母 |
static boolean |
isAllNonChinese(byte[] sString)
是否全部不是中文 |
static boolean |
isAllNum(String str)
是否全是数字 |
static boolean |
isAllSingleByte(String str)
是否全是单字节 |
static boolean |
isBlank(CharSequence cs)
判断字符串是否为空(null和空格) |
static boolean |
isChinese(char c)
判断某个字符是否为汉字 |
static boolean |
isDBCCase(String str)
判断该字符串是否是半角字符 |
static boolean |
isDelimiter(String str)
判断是否是一个连字符(分隔符) |
static boolean |
isInAggregate(String aggr,
String str)
判断一个字符串的所有字符是否在另一个字符串集合中 |
static boolean |
isSBCCase(String str)
判断该字符串是否是全角字符 |
static boolean |
isUnknownWord(String word)
|
static boolean |
isYearTime(String snum)
判断字符串是否是年份 |
static String |
join(String delimiter,
Collection<String> stringCollection)
|
static char[] |
long2char(long x)
转换long型为char数组 |
static String |
long2String(long x)
转换long类型为string |
static double |
nonZero(double frequency)
防止频率为0发生除零错误 |
static void |
writeString(String s,
DataOutputStream out)
简单好用的写String方式 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int CT_SINGLE
public static final int CT_DELIMITER
public static final int CT_CHINESE
public static final int CT_LETTER
public static final int CT_NUM
public static final int CT_INDEX
public static final int CT_OTHER
| 构造方法详细信息 |
|---|
public TextUtility()
| 方法详细信息 |
|---|
public static int charType(char c)
public static int charType(String str)
str -
public static boolean isAllChinese(String str)
str -
public static boolean isAllNonChinese(byte[] sString)
sString -
public static boolean isAllSingleByte(String str)
str -
public static int cint(String str)
str - 要转换的字符串
public static boolean isAllNum(String str)
str -
public static boolean isAllIndex(byte[] sString)
sString -
public static boolean isAllLetter(String text)
text -
public static boolean isAllLetterOrNum(String text)
text -
public static boolean isAllDelimiter(byte[] sString)
sString -
public static boolean isAllChineseNum(String word)
word -
public static int getCharCount(String charSet,
String word)
charSet - word -
public static int getUnsigned(byte b)
b -
public static boolean isYearTime(String snum)
snum -
public static boolean isInAggregate(String aggr,
String str)
aggr - 字符串集合str - 需要判断的字符串
public static boolean isDBCCase(String str)
str -
public static boolean isSBCCase(String str)
str -
public static boolean isDelimiter(String str)
str -
public static boolean isUnknownWord(String word)
public static double nonZero(double frequency)
frequency -
public static char[] long2char(long x)
x - public static String long2String(long x)
x -
public static String exceptionToString(Exception e)
e -
public static boolean isChinese(char c)
c - 需要判断的字符
public static int count(String keyword,
String srcText)
keyword - srcText -
public static void writeString(String s,
DataOutputStream out)
throws IOException
s - out -
IOExceptionpublic static boolean isBlank(CharSequence cs)
cs -
public static String join(String delimiter,
Collection<String> stringCollection)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||