123456789101112131415161718192021222324252627282930313233 |
- /// 字符串工具类
- class StringUtils {
- StringUtils._();
- static String boolStr(bool? value) {
- return switch (value) {
- true => '是',
- false => '否',
- _ => '',
- };
- }
- static String boolStrByNum(num? value) {
- return switch (value) {
- 0 => '是',
- 1 => '否',
- _ => '',
- };
- }
- /// 判断是否是手机号
- static bool isPhoneNum(String? nums) {
- if(nums == null){
- return false;
- }
- RegExp mobile = RegExp(
- r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$');
- return mobile.hasMatch(nums);
- }
- }
|