- // 中文英文标点混合的字符串
- String str = "/*(薛聪,美得让人心碎。Oh, My God!)*/";
- // 将非数字、英文字母、汉字的部分替换为空后,就剩数字、英文字母、汉字了
- str = str.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5]", "");
- // 输出为"薛聪美得让人心碎OhMyGod"
- System.out.println(str);
1413

被折叠的 条评论
为什么被折叠?