StringUtils class abstract

Constructors

StringUtils()

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

abbreviate(String? str, int maxWidth, {int offset = 0}) String?
使用点缩写字符串
compare(String? str1, String? str2) int
比较两个字符串是否相同
contains(String? str, Pattern searchPattern, [int startIndex = 0]) bool
判断字符串中是否包含xx
containsAny(String? str, List<Pattern> searchPatterns, [int startIndex = 0]) bool
判断一个字符串是否包含任何给定的搜索模式
formatComma3(Object? num) String
每隔3三位加逗号 num 数字或数字字符串。int型。
formatDigitPattern(String? text, {int digit = 4, String pattern = ' '}) String
每隔 x位 加 pattern。比如用来格式化银行卡
formatDigitPatternEnd(String? text, {int digit = 4, String pattern = ' '}) String
每隔 x位 加 pattern, 从末尾开始
formatDoubleComma3(Object? num, {int digit = 3, String pattern = ','}) String
每隔3三位加逗号 num 数字或数字字符串。double型。
formatSpace4(String? text) String
每隔4位加空格
hammingDistance(String str1, String str2) int
比较两个长度一样的字符串有几个字符不同
hasCapitalLetter(String s) bool
字符串是否包含最少一个大写字母
hasLength(dynamic value) bool
value 是否有长度属性
hasMatch(String? value, String pattern) bool
字符串是否符合正则表达式
hideNumber(String? phoneNo, {int start = 3, int end = 7, String replacement = '****'}) String
隐藏手机号中间n位
isAlphabetOnly(String s) bool
字符串中是否只包含字母
isAPK(String filePath) bool
文件是否是APK
isAudio(String filePath) bool
文件是否是音频
isBinary(String s) bool
检验字符串是否是二级制
isBool(String value) bool
是否是bool值
isChinese(String s) bool
字符串是否是中文
isChm(String filePath) bool
文件是否是Chm
isEmail(String s) bool
检验字符串是否是邮箱
isEmpty(String? value) bool
判断字符串或者集合是否为空
isExcel(String filePath) bool
文件是否是Excel
isHexadecimal(String s) bool
检验字符串是否是表示颜色的字符串
isHTML(String filePath) bool
文件是否是HTML
isImage(String filePath) bool
文件是否是图片
isIPv4(String s) bool
检验字符串是否是IPV4
isIPv6(String s) bool
检验字符串是否是IPV6
isMD5(String s) bool
检验字符串是否是MD5
isNotEmpty(dynamic value) bool
判断字符串或者集合是否不为空
isNull(String? value) bool
判断值是否为null
isNullOrBlank(dynamic value) bool
判断value是null 或者为空集合或者空字符串
isNum(String value) bool
判断字符串是否为数字(int,double)
isNumericOnly(String s) bool
字符串中是否只包含数字
isPDF(String filePath) bool
文件是否是PDF
isPhoneNumber(String s) bool
检验字符串是否是手机号
isPPT(String filePath) bool
文件是否是PPT
isSHA1(String s) bool
检验字符串是否是SHA1编码字符
isSHA256(String s) bool
检验字符串是否是SHA256编码字符
isTxt(String filePath) bool
文件是否是Txt
isVector(String filePath) bool
文件是否是Vector
isVideo(String filePath) bool
文件是否是视频
isWord(String filePath) bool
文件是否是Word
replace(String? text, Pattern from, String replace) String
替换字符串中的数据
reverse(String? text) String
反转字符串
split(String? text, Pattern pattern) List<String>
按照正则切割字符串
startsWith(String? str, Pattern prefix, [int index = 0]) bool
判断字符串是以xx开头
startsWithAny(String? str, List<Pattern> prefixes, [int index = 0]) bool
判断一个字符串以任何给定的前缀开始