/** * @author lautturi.com * Java example: replace substring of string case insensitive in java */ import java.util.*; public class Lautturi { public static void main(String[] args) { String str = "welcom to Java world. jaVa is a high-level programming language."; str = str.replaceAll("(?i)java", "JAVA"); System.out.println(str); } }Sruoce:www.lautturi.com
output:
welcom to JAVA world. JAVA is a high-level programming language.