正则表达式验证字符串是否包含空格

    xiaoxiao2021-03-26  26

    /** * 验证是否字符串包含空格 * * @param phone 需要字符串 * @return 不包含返回true 包含返回false * @author 孙磊 * @version 1.0 * @time 2016-12-30 * @status 正常 */ public static boolean containSpace(String phone) { Pattern pattern = Pattern.compile("[0-9a-zA-Z\u4E00-\u9FA5]+"); Matcher matcher = pattern.matcher(phone); return matcher.matches(); }
    转载请注明原文地址: https://ju.6miu.com/read-450381.html

    最新回复(0)