当前位置: 代码迷 >> Web前端 >> 正则轮换字符串的全角、半角标点符号
  详细解决方案

正则轮换字符串的全角、半角标点符号

热度:251   发布时间:2012-09-21 15:47:26.0
正则替换字符串的全角、半角标点符号

  1. class ?T?{
  2. ?? public ? static ? void ?main(String[] args)?{
  3. ????String?str?=? "!!!!去符号标号!!当然。!!..**半角" ;
  4. ????System.out.println(str);
  5. ????System.out.println(str.replaceAll( "\\p{Punct}" ,? "" ));\\替换半角
  6. ????System.out.println(str.replaceAll( "\\pP" ,? "" ));\\替换所有
  7. ??}
  8. }

?

  相关解决方案