Java String Ends With endsWith(String s, String end)

Here you can find the source of endsWith(String s, String end)

Description

ends With

License

Open Source License

Declaration

public static boolean endsWith(String s, String end) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean endsWith(String s, char end) {
        return endsWith(s, (new Character(end)).toString());
    }/*from   w  ww .  j  a  v  a2  s. co m*/

    public static boolean endsWith(String s, String end) {
        if ((s == null) || (end == null)) {
            return false;
        }

        if (end.length() > s.length()) {
            return false;
        }

        String temp = s.substring(s.length() - end.length(), s.length());

        if (temp.equalsIgnoreCase(end)) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. endsWith(String inEnd, String inValue)
  2. endsWith(String receiver, String... needles)
  3. endsWith(String s, char c)
  4. endsWith(String s, String end)
  5. endsWith(String s, String end)
  6. endsWith(String s, String ending)
  7. endsWith(String s, String suffix)
  8. endsWith(String s1, String s2)
  9. endsWith(String source, String target, boolean caseSensitive)