Write code to ends With Ignore Case
//package com.book2s; public class Main { public static void main(String[] argv) { String target1 = "book2s.com"; String target2 = "book2s.com"; System.out.println(endsWithIgnoreCase(target1, target2)); }/*from w ww. j a v a2 s. co m*/ public static boolean endsWithIgnoreCase(final String target1, final String target2) { if (target1 == null || target2 == null) { return false; } int length1 = target1.length(); int length2 = target2.length(); if (length1 < length2) { return false; } String s1 = target1.substring(length1 - length2); return s1.equalsIgnoreCase(target2); } public static boolean equalsIgnoreCase(final String target1, final String target2) { return (target1 == null) ? (target2 == null) : target1 .equalsIgnoreCase(target2); } }