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");
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment