Programming Tips - Java: Simple case insensitive string replace

Date: 2013aug26 Language: Java Q. Java: Simple case insensitive string replace A. This example will make all cases of "heLLO" into "Hello"
Pattern pat = Pattern.compile("hELLo", Pattern.CASE_INSENSITIVE); String changeHello(String in) { return pat.matcher(in).replaceAll("Hello"); }