Java String Ends With endsWithChar(String s, char c)

Here you can find the source of endsWithChar(String s, char c)

Description

ends With Char

License

Open Source License

Declaration

public static boolean endsWithChar(String s, char c) 

Method Source Code

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

public class Main {

    public static boolean endsWithChar(String s, char c) {
        if (s.length() == 0) {
            return false;
        }//from  www  .ja  va2 s  . com
        return s.charAt(s.length() - 1) == c;
    }

    /**
     * Gets a String's length or <code>0</code> if the String is
     * <code>null</code>.
     *
     * @param str
     *            a String or <code>null</code>
     * @return String length or <code>0</code> if the String is
     *         <code>null</code>.
     * @since 2.4
     */
    public static int length(String str) {
        return str == null ? 0 : str.length();
    }
}

Related

  1. endsWithAnyCI(String string, String... suffixes)
  2. endsWithAnyIC(String str, String[] needles)
  3. endsWithBackslash(final String s)
  4. endsWithChar(CharSequence s, char suffix)
  5. endsWithChar(final String s, final char c)
  6. endsWithChar(String string, char suffix)
  7. endsWithChar(String string, int character)
  8. endsWithContinuationMarker(String line)
  9. endsWithCVC(String str)