Example:
1 2 3 4 5 6 7 8 9 10 | class Solution{ public static void main(String []arg) { String sample = "123 123 123 123 321" ; String replaced = sample.replaceAll( "123" , "111" ); System.out.println( "orginal string: " + sample); System.out.println( "replaced string: " + replaced); } } |