Here you can find the source of endsWith(String str, char suffix)
Parameter | Description |
---|---|
str | string to check first char |
suffix | the suffix. |
public static boolean endsWith(String str, char suffix)
//package com.java2s; //License from project: LGPL public class Main { /**/* ww w .j av a 2 s .c om*/ * Tests if this string ends with the specified suffix. * @param str string to check first char * @param suffix the suffix. * @return is last of given type */ public static boolean endsWith(String str, char suffix) { return str != null && str.length() > 0 && str.charAt(str.length() - 1) == suffix; } public static int length(String str) { if (str == null) return 0; return str.length(); } }