ValidatorHelper.ets 288 B

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