小程序-----输出字符串中的中文字符
2015-09-07 23:16
603 查看
今天笔试的时候遇到的一道试题,当时就知道使用正则表达式检查,但是就是不知道具体的实现,好多东西东是这样,导致笔试都没有过,尴尬。。。。。。。。。。。。。
现在把它写出来,没事多总结。
--------------------------------------------------------------------------------------------------------------------------------------------------------
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class test4 {
public static void main(String[] args) {
String test = "面试dwe顺利dwe2dfw2we!ewefnw";
Pattern p = Pattern.compile("([\u4e00-\u9fa5]+)");
Matcher m = p.matcher(test);
String s = null;
while(m.find()){
s=m.group(0);
System.out.print(s);
}
}
}
现在把它写出来,没事多总结。
--------------------------------------------------------------------------------------------------------------------------------------------------------
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class test4 {
public static void main(String[] args) {
String test = "面试dwe顺利dwe2dfw2we!ewefnw";
Pattern p = Pattern.compile("([\u4e00-\u9fa5]+)");
Matcher m = p.matcher(test);
String s = null;
while(m.find()){
s=m.group(0);
System.out.print(s);
}
}
}
相关文章推荐
- 微信开发
- 微信公共平台开发5 .net
- js判断手机浏览器操作系统和微信浏览器的方法
- 微信公共平台开发4 .net
- 微信公共平台开发3 .net
- 微信公共平台开发2 .net
- php实现微信中的图片合并 (圆角) -九宫格图片实现
- 仿微信和QQ页面滑动效果(Fragment和ViewPager)
- php实现微信中的图片合并-九宫格图片
- 小程序
- java自己写的一个小程序
- 淘宝鹊桥计算工具安卓版小程序
- 微信公众账号第三方平台全网发布源码(java)- 实战测试通过
- 微信公众账号第三方平台全网发布源码(java)- 实战测试通过
- IOS 仿微信摇一摇
- 监控服务器调用微信API给自己发告警信息 推荐
- 个人微信号 卖货、品宣、推广 有那些实用的操作要点?
- 个人微信号 卖货、品宣、推广 有那些实用的操作要点?
- 微信公众平台后台接入简明指南
- 微信网页授权