Browse - Programming Tips - How can I do a simple case insensitive string replace?

Date: 2013aug26
Language: Java

Q.  How can I do a 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"); }