Java tutorial
//package com.java2s; public class Main { public static boolean equal(String s1, String s2, boolean p_ignoreCase) { if ((s1 == null) || (s2 == null)) return false; if (p_ignoreCase) return s1.equalsIgnoreCase(s2); return s1.equals(s2); } public static boolean equalsIgnoreCase(String str1, String str2) { if (str1 == null) { return str2 == null; } return str1.equalsIgnoreCase(str2); } public static boolean equals(String str1, String str2) { if (str1 == null) { return str2 == null; } return str1.equals(str2); } }