Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace substrings that contain any integer in java?

How to replace a sub-string in java of form " :[number]: "

example:

string="Hello:6:World"

After replacement,

HelloWorld
like image 655
Khaled Saifullah Avatar asked Feb 21 '26 18:02

Khaled Saifullah


1 Answers

ss="hello:909:world"; 

do as below:

String value = ss.replaceAll("[:]*[0-9]*[:]*","");
like image 179
WannaBeCoder Avatar answered Feb 23 '26 08:02

WannaBeCoder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!