![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
regex
月慕向阳
....
展开
-
正则判断字串包含有某些字符(比如标点)
public static void main(String[] args) { //String ss=".*(\\!|!|。|\\.|\\?|?).*"; String reg= "^.*[(¿)|(?)|(?)|(!)|(。)|(.)|(¡)|(!)|(!)|(!)].*$"; boolean matches = "haha hah hahs.".matches(reg);...原创 2018-08-17 17:24:29 · 14420 阅读 · 0 评论 -
判断字符串中是否包含中文
/** * 判断字符串中是否包含中文 * @param str * 待校验字符串 * @return 包含的中文 * @warn 不能校验是否为中文标点符号 */ public static String getContainChinese(String str) { Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); ...原创 2018-09-13 14:50:33 · 1107 阅读 · 0 评论