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

Popular posts from this blog

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -