Java String Ends With endsWith(final CharSequence a, final CharSequence b)

Here you can find the source of endsWith(final CharSequence a, final CharSequence b)

Description

ends With

License

Open Source License

Declaration

public static boolean endsWith(final CharSequence a, final CharSequence b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static boolean endsWith(final CharSequence a, final CharSequence b) {
        final int len = b.length();
        final int off = len - a.length();
        if (off < 0) {
            return false;
        }/* www.j a va2s  .com*/

        for (int i = 0; i < len; i++) {
            if (a.charAt(off + i) != b.charAt(i)) {
                return false;
            }
        }

        return true;
    }
}

Related

  1. endsWith(CharSequence str, char suffix)
  2. endsWith(CharSequence str, CharSequence suffix)
  3. endsWith(final boolean caseSensitive, final String text, final String suffix)
  4. endsWith(final byte[] big, final byte[] suffix)
  5. endsWith(final byte[] str1, int startIndex1, int endIndex1, final byte[] str2, int startIndex2, int endIndex2)
  6. endsWith(final CharSequence str, final CharSequence suffix)
  7. endsWith(final CharSequence target, final CharSequence suffix)
  8. endsWith(final Object[] left, final Object[] right, final boolean equals)
  9. endsWith(final String path, final String suffix)