NSStringUtil class

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clipboardCopy(String text) Future<void>
isEmail(String s) bool
格式校验
isSimilar(String a, String b) bool
去掉空格并转为小写作对比
isURL(String s) bool
格式校验
takeFirst(String value, int n) String
获取起始n个字符
takeLast(String value, int n) String
获取最后n个字符
toCamelCase(String value) String
去掉空格并转为小写作对比
toCapitalized(String value) String
仅首字母大写,其余都小写
toCardExpiry(String value, {String separator = "/"}) String
MMYY 变成 MM/YY
toLettersNumbersOnly(String value) → dynamic
只保留字母和数字
toNumbersOnly(String value) → dynamic
只保留数字
toObscuredCardNumber(String value, {String obscureText = "•", int targetLength = 16, int separatedBy = 4, String separator = " ", bool substringFromEnd = true, bool separateFromEnd = true}) String
改成带※的卡号
toObscuredEmail(String value, {String obscureText = "•"}) String
abcde@123.com => ab*@*3.com
toSeparated(String value, int n, {bool fromEnd = false, String separator = " "}) String
每n个字中间加符号
toSingleSpace(String value) → dynamic
去掉多余的空格,拒绝后端垃圾数据
toSingleSpaceNoBreak(String value) → dynamic
去掉多余的空格和换行,拒绝后端垃圾数据
toSnakeCase(String text, {String separator = '_'}) String
convertThisToThis => convert_this_to_this
toTitleCase(String value) String
每个词的首字母大写