Albert Network Note
Tuesday, March 24, 2015
How to use Replace & ReplaceAll in Java
Replace character
String newstring = str1.replace("-",",");
Replace string
String newstring = str1.replaceAll("[a-z]","0");
Replace string only for first match
String newstring = str1.replaceFirst("[a-z]","0");
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)