Posts Tagged ‘微信’

微信昵称中的特殊字符的过滤

2014-10-16 by Jinyang | No Comments | Filed in 技术相关

/*** * 微信的昵称中特殊字符的过滤 * ***/ public static String wxNickName(String str) { // TODO Auto-generated method stub String ret = “”; try { byte[] utf8Bytes = str.getBytes(“UTF-8”); ret = new String(utf8Bytes, “UTF-8”); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Pattern unicodeOutliers = Pattern.compile(“[^\\x00-\\x7F]”, Pattern.UNICODE_CASE | Pattern.CANON_EQ | Pattern.CASE_INSENSITIVE); Matcher unicodeOutlierMatcher = unicodeOutliers.matcher(ret); //System.out.println(“Before: ” + ret); […]

Tags:

返回顶部