/** * @author lautturi.com * Java example: remove punctuation from string in java */ import java.util.*; public class Lautturi { public static void main(String[] args) { String str = "hello, welcome to \"lau' java world !"; System.out.println(str); str = str .replaceAll("\\p{Punct}", ""); System.out.println(str); } }Source:www.lautturi.com
output:
hello, welcome to "lau' java world ! hello welcome to lau java world