黑马程序员技术交流社区

标题: 【上海校区】【Java后端】java通过正则表达式去掉字符串中... [打印本页]

作者: 不二晨    时间: 2018-12-28 17:51
标题: 【上海校区】【Java后端】java通过正则表达式去掉字符串中...
String tmp = "xxxx123"
String description = Pattern.compile("[\\d]").matcher(tmp).replaceAll("");
// description = xxxx
1
2
3
解析:\d表示数字字符,将目标字符串中的数字字符全部替换成空串并返回新串。
---------------------
转载,仅作分享,侵删
作者:咸煌
原文:https://blog.csdn.net/qq_21084687/article/details/83586659



作者: 不二晨    时间: 2019-1-3 10:10
奈斯




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2