Java清除標點符號的正則表示式
阿新 • • 發佈:2018-12-21
轉載請註明:http://www.pmjava.com/?thread-62961-1.html
[java] view plain copy print?- package com.test;
- publicclass StringTest {
- publicstaticvoid main(String... args) {
- String str = "!!!??!!!!%*)%¥!KTV去符號標號!!當然。!!..**半形";
- // System.out.println(str);
- System.out.println(str.replaceAll("//p{Punct}"
- System.out.println(str.replaceAll("//pP", ""));
- System.out.println(str.replaceAll("//p{P}", ""));
- }
- }