Class: StringTool

tool. StringTool

字符串工具类

new StringTool()

Methods


<static> clearClutter(string)

清除所有特殊字符
Parameters:
Name Type Description
string string 字符串
Returns:
结果字符串
Type
string

<static> clearComma(string)

清除所有逗号
Parameters:
Name Type Description
string string 字符串
Returns:
结果字符串
Type
string

<static> clearSpace(string)

清除所有空格字符
Parameters:
Name Type Description
string string 字符串
Returns:
结果字符串
Type
string

<static> clearVertical(string)

清除所有竖线
Parameters:
Name Type Description
string string 字符串
Returns:
结果字符串
Type
string

<static> isEmail(email)

检验是否为邮箱
Parameters:
Name Type Description
email string 邮箱
Returns:
结果
Type
boolean

<static> isEmpty(string)

校验是否为空字符串
Parameters:
Name Type Description
string string 字符串
Returns:
结果
Type
boolean

<static> isMobile(mobile)

校验是否为手机号码
Parameters:
Name Type Description
mobile string 手机号码
Returns:
结果
Type
boolean

<static> isPassword(password, minLength, maxLength)

校验是否为密码
Parameters:
Name Type Description
password string 密码
minLength number 最小长度
maxLength number 最大长度
Returns:
结果
Type
boolean

<static> isPhoneNumber(phone)

校验是否为电话号码
Parameters:
Name Type Description
phone string 电话号码
Returns:
结果
Type
boolean

<static> isVerifyCode(verifycode)

校验是否为验证码(即0~9 6位数字)
Parameters:
Name Type Description
verifycode string 验证码
Returns:
结果
Type
boolean

<static> numberFromASC(ascChar)

通过asc得出字符数值
Parameters:
Name Type Description
ascChar string asc字符
Returns:
数值 A=0; B=1;
Type
number

<static> numberFromString(string, force, offset)

转换字符串到数字
Parameters:
Name Type Description
string string 字符串
force boolean 是否强制转换非数字字符 (即为26进制数字)
offset number 非数字时的初始值
Returns:
数值
Type
number

<static> numberRemoveLeftZero(c)

去除数字左边所有0
Parameters:
Name Type Description
c
Returns:
Type
*