How to take out the numbers from the String and eliminate those number and store the filtered String and print it in java

huangapple go评论74阅读模式
英文:

How to take out the numbers from the String and eliminate those number and store the filtered String and print it in java

问题

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

答案1

得分: 1

因为我很无聊...

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

Because i'm bored...

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

答案2

得分: 0

这将从字符串中删除所有数字字符

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

This will all numerical charactors from string

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

huangapple
  • 本文由 发表于 2020年10月9日 14:36:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/64275054.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定