Showing posts with label characters. Show all posts
Showing posts with label characters. Show all posts

Wednesday, November 13, 2013

how to replace all characters in a java string

String line = "Pritom K Mondal";
line = line.replaceAll("(?s).", "X");

Will output:
XXXXXXXXXXXXXXX
 
The (?s) doesn't match anything but sets the DOTALL flag.