如何从字符串中取出数字并消除这些数字,存储过滤后的字符串并用java打印


String txt = "d89%l++5r19o7W *o=1645le9H"
System.out.println(t.replace(/\d{0,}/g,''));

因为我无聊。。。

String txt = "d89%l++5r19o7W *o=1645le9H";
txt = txt.replaceAll("\d", "")
System.out.println(txt);

这将来自字符串的所有数字字符

System.out.println(string.replaceAll("\d",""));

最新更新