You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
498 B
20 lines
498 B
3 years ago
|
class TextUtils {
|
||
|
///判断空字符串
|
||
|
///
|
||
|
///white 全空格是否算空字符串
|
||
|
static bool isEmpty(String str, {bool whiteSpace = false}) {
|
||
|
if (whiteSpace) {
|
||
|
return str == null || str.trim().length == 0;
|
||
|
}
|
||
|
return str == null || str.length == 0;
|
||
|
}
|
||
|
|
||
|
static bool isNotEmpty(String str, {bool whiteSpace = false}) {
|
||
|
return !isEmpty(str, whiteSpace: whiteSpace);
|
||
|
}
|
||
|
|
||
|
static bool verifyPhone(phone) {
|
||
|
return new RegExp("^^1\\d{10}\$").hasMatch(phone);
|
||
|
}
|
||
|
}
|