Java String Ends With endsWith(String str, String mark)

Here you can find the source of endsWith(String str, String mark)

Description

ends With

License

Apache License

Declaration

private static boolean endsWith(String str, String mark) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static boolean endsWith(String str, String mark) {
        return startsWith(str, mark, str.length() - mark.length());
    }/*from  w  w w  .ja v a  2s. co  m*/

    private static boolean startsWith(String str, String mark, int paramInt) {
        char[] value = str.toCharArray();
        if ((paramInt < 0) || paramInt > value.length) {
            return false;
        }
        int k = mark.length();
        char[] chars = mark.toCharArray();
        while (--k >= 0) {
            if (value[paramInt + k] != chars[k]) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. endsWith(String source, String target, boolean caseSensitive)
  2. endsWith(String str, char c)
  3. endsWith(String str, char suffix)
  4. endsWith(String str, char suffix)
  5. endsWith(String str, String end, boolean caseSensitive)
  6. endsWith(String str, String suffix)
  7. endsWith(String str, String suffix)
  8. endsWith(String str, String suffix, boolean ignoreCase)
  9. EndsWith(String str, String suffix, int strStartPos)