WordUtil { public static boolean hasTrailingCharacter(String str, String matchChars) { for (int i = str.length() - 1; i > 0; i--) { final char ch = str.charAt(i); final int index = matchChars.indexOf(ch); if (index != -1) { return true; } else { break; } } return false; }  static String removeSurrounding(final String token); static boolean isAlphaNumberic(String str); static boolean isMixedCase(String str); static boolean isUpperAlphaNumberic(String str); static boolean isAlphabetic(String str); static boolean hasVowel(String str); static boolean hasConsonant(String str); static boolean hasVowelAndConsonant(String str); static boolean hasCharacter(String str, String matchChars); static boolean hasTrailingCharacter(String str, String matchChars); static boolean hasTrailingPuncuation(String str); static int countLeadChar(String str, char matchChar); static boolean startsWithCharacter(String str, String matchChars); static String compactRepeatedChars(String str); static String toUnicode(String str); static String toDecimal(String str); static boolean hasNumber(String str); static boolean hasLetter(String str); static boolean hasCapital(String str); static boolean startsWithCapital(String str); static boolean hasAllCapitals(String str); static String getCapital(String seq); static String capitalize(String str, char[] wordDelimiters); static String capitalizeTitle(String str); static String capitalizeTitle(String str, char[] wordDelimiters); static boolean hasWord(String segment, Collection<String> stopwords); static boolean hasWord(String segment, String wordDelimiters, Collection<String> stopwords); static boolean hasWord(StringTokenizer tokenizer, Collection<String> stopwords); static boolean hasLeadWord(String segment, Collection<String> stopwords, boolean caseSensative); static boolean hasLeadWord(String segment, String wordDelimiters, Collection<String> stopwords,
			boolean caseSensative); static boolean hasLeadWord(StringTokenizer tokenizer, Collection<String> stopwords, boolean caseSensative); static int countWords(String segment, char[] wordDelimiters); static String initials(String segment); static String initials(String segment, char[] wordDelimiters); static String longestCommonSubstring(String word1, String word2);  }
@Test public void hasTrailingCharacter() { assertTrue(WordUtil.hasTrailingCharacter("ending.", ".;,:")); assertFalse(WordUtil.hasTrailingCharacter("ending.abc", ".;,:")); assertFalse(WordUtil.hasTrailingCharacter(".leading", ".;,:")); }