Java string replace using regex -
Java string replace using regex -
i have strings values "address line1", "address line2" ... etc. want add together space if there numeric value in string "address line 1", "address line 2".
i can using contains , replace this
string sample = "address line1"; if (sample.contains("1")) { sample = sample.replace("1"," 1"); }
but how can using regex?
sample = sample.replaceall("\\d+"," $0");
java regex
Comments
Post a Comment