Java String Ends With endsWithIgnoreCase(String str, String suffix)

Here you can find the source of endsWithIgnoreCase(String str, String suffix)

Description

ends With Ignore Case

License

Open Source License

Declaration

public static boolean endsWithIgnoreCase(String str, String suffix) 

Method Source Code

//package com.java2s;

public class Main {

    public static boolean endsWithIgnoreCase(String str, String suffix) {
        if (str == null || suffix == null) {
            return false;
        }//  w  w  w.j  a v a 2s.c o  m
        if (str.endsWith(suffix)) {
            return true;
        }
        if (str.length() < suffix.length()) {
            return false;
        }

        String lcStr = str.substring(str.length() - suffix.length()).toLowerCase();
        String lcSuffix = suffix.toLowerCase();
        return lcStr.equals(lcSuffix);
    }
}

Related

  1. endsWithIgnoreCase(String str, String suffix)
  2. endsWithIgnoreCase(String str, String suffix)
  3. endsWithIgnoreCase(String str, String suffix)
  4. endsWithIgnoreCase(String str, String suffix)
  5. endsWithIgnoreCase(String str, String suffix)
  6. endsWithIgnoreCase(String str, String suffix)
  7. endsWithIgnoreCase(String string, String suffix)
  8. endsWithIgnoreCase(String target1, String target2)
  9. endsWithIgnoreCase(String text, String suffix)