Here you can find the source of endsWithIgnoreCase(final String input, final String suffix)
Parameter | Description |
---|---|
input | string to check |
suffix | suffix to check |
Parameter | Description |
---|---|
IllegalArgumentException | if Input or Suffix is null |
public static boolean endsWithIgnoreCase(final String input, final String suffix)
//package com.java2s; //License from project: Creative Commons License public class Main { /**/*from w ww . ja v a 2 s . c o m*/ * Checks if a string ends with a given suffix. * @param input string to check * @param suffix suffix to check * @return true if string ends with a given suffix * @throws IllegalArgumentException if Input or Suffix is null */ public static boolean endsWithIgnoreCase(final String input, final String suffix) { if (input == null) throw new IllegalArgumentException("Input cannot be null!"); if (suffix == null) throw new IllegalArgumentException("Suffix cannot be null!"); return input.endsWith(suffix) || input.length() >= suffix.length() && input.toLowerCase().endsWith(suffix.toLowerCase()); } }