Java String Ends With endsWith(final String str, final String... suffixes)

Here you can find the source of endsWith(final String str, final String... suffixes)

Description

Nullpointer save version of String.endsWith.

License

Open Source License

Return

True, if the given string ends with one of the given suffixes, otherwise false.

Declaration

public static boolean endsWith(final String str, final String... suffixes) 

Method Source Code

//package com.java2s;
// ProjectForge is dual-licensed.

public class Main {
    /**/*from  w  w  w .  ja v  a 2 s.c o  m*/
     * Nullpointer save version of String.endsWith.
     * @return True, if the given string ends with one of the given suffixes, otherwise false.
     * @see String#endsWith(String)
     */
    public static boolean endsWith(final String str, final String... suffixes) {
        if (str == null || suffixes == null) {
            return false;
        }
        for (final String suffix : suffixes) {
            if (str.endsWith(suffix) == true) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. endsWith(final Object[] left, final Object[] right, final boolean equals)
  2. endsWith(final String path, final String suffix)
  3. endsWith(final String s, final String suffix, final boolean ignoreCase)
  4. endsWith(final String src, final String... suffixes)
  5. endsWith(final String str, final char suffix)
  6. endsWith(final String string, final String[] suffixes)
  7. endsWith(final StringBuilder builder, final char match)
  8. endsWith(int[] data, int[] ends)
  9. endsWith(String a, char[] b)