I have three Strings and I want to replace the date from stringsby using replaceall. but the date number is in middle of thestrings and I couldn’t figure out how to to do that.
String s1 = “Proce.Arr.20190416.server10”;
String s2 = “Proce.Arr.20190416.ball10”;
String s3 = “Proce.Arr.20190416.ball23”;
I want to replace 20190416 from each strings by “”; I trieds1.replaceall(“[^0-9]”, “”); However, it printout wrong.
Solution
String s1 = “Proce.Arr.20190416.server10”;
String s2 = “Proce.Arr.20190416.ball10”;
String s3 = “Proce.Arr.20190416.ball23”;
System.out.println(s1.replaceAll(“20190416″,””));
System.out.println(s2.replaceAll(“20190416″,””));
System.out.println(s3.replaceAll(“20190416”, “”));
===================================================================
SEE OUTPUT
Thanks, PLEASE COMMENT if there is any concern.
6 <terminated> Array2d [Java Application] /l