public class TestReplaceAll {
public static void main(String[] args) {
String str = "I am a programMeR";
System.out.println("input : " + str);
str = str.replaceAll("(?i)programmer", "developer");
System.out.println("output : " + str);
}
}
This program might be helpful in replacing words which are not consistent with respect to case in a string. This piece of code was given by a colleague.
No comments:
Post a Comment