ValidatorHelper.ets 258 B

1234567891011121314
  1. /**
  2. * 常用正则验证
  3. */
  4. export class ValidatorHelper {
  5. /**
  6. * 是否为手机号
  7. * @param phone
  8. * @returns
  9. */
  10. public static isPhone(phone: string) {
  11. let regexp: RegExp = new RegExp('^1[0-9]{10}$');
  12. return regexp.test(phone)
  13. }
  14. }