Here you can find the source of endsWithChar(String s, char c)
public static boolean endsWithChar(String s, char c)
//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(); } }