Reputation: 448
I have a signed string like this: "Làm sao để chuyển chuổi có dấu về không dấu?"
And I want to translate it to string like this: "Lam sao de chuyen chuoi co dau ve khong dau?"
Please tell me the way to solve it in Java code. Thanks a lot!
Upvotes: 0
Views: 1139
Reputation: 1330
Something like
public static void main(String args[]) {
String src = "Làm sao để chuyển chuổi có dấu về không dấu?";
String dest = Normalizer.normalize(src, Normalizer.Form.NFD);
dest = dest.replaceAll("[^\\p{ASCII}]", "");
System.out.println(src);
System.out.println(dest);
}
gives you
Làm sao để chuyển chuổi có dấu về không dấu?
Lam sao e chuyen chuoi co dau ve khong dau?
Upvotes: 1