检查一个字符串是否符合固定电话格式
import { isFixedTelephoneNumber } from "check-string"; ... let str = "010-22345678" let result = isFixedTelephoneNumber(str, { canNull: true }); //str可以为null if(!result.success) { console.log(result.error.code); // 输出错误编号 console.log(result.error.cn); // 输出错中文错误 console.log(result.error.en); // 输出错英文错误 }
被检查的字符串
检查一个字符串是否符合固定电话格式