Java String Ends With endsWith(String string, String... endsWithText)

Here you can find the source of endsWith(String string, String... endsWithText)

Description

return true if the string endsWith in any endsWithText

License

Apache License

Parameter

Parameter Description
string String
endsWithText String ...

Return

boolean

Declaration

public static boolean endsWith(String string, String... endsWithText) 

Method Source Code

//package com.java2s;
/*/*from   w ww . java2  s. co m*/
 * Copyright 2015 Pegasus Solutions
 * @author Rafael Peres dos Santos
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
 * applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * ================================================================================
 *
 * Direitos autorais 2015 Pegasus Solutions
 * @author Rafael Peres dos Santos
 * 
 * Licenciado sob a Licen?a Apache, Vers?o 2.0 ("LICEN?A"); voc? n?o pode usar
 * esse arquivo exceto em conformidade com a esta LICEN?A. Voc? pode obter uma
 * c?pia desta LICEN?A em http://www.apache.org/licenses/LICENSE-2.0 A menos que
 * haja exig?ncia legal ou acordo por escrito, a distribui??o de software sob
 * esta LICEN?A se dar? ?COMO EST????, SEM GARANTIAS OU CONDI??ES DE QUALQUER
 * TIPO, sejam expressas ou t?citas. Veja a LICEN?A para a reda??o espec?fica a
 * reger permiss?es e limita??es sob esta LICEN?A.
 *
 */

public class Main {
    /**
     * return true if the string endsWith in any endsWithText
     * 
     * @param string {@link String}
     * @param endsWithText {@link String}...
     * @return boolean
     */
    public static boolean endsWith(String string, String... endsWithText) {
        if (endsWithText != null) {
            for (String endWithText : endsWithText) {
                if (string.endsWith(endWithText)) {
                    return true;
                }
            }
        }

        return false;
    }
}

Related

  1. endsWith(String str, String suffix)
  2. endsWith(String str, String suffix, boolean ignoreCase)
  3. EndsWith(String str, String suffix, int strStartPos)
  4. endsWith(String string, char character)
  5. endsWith(String string, String... end)
  6. endsWith(String value, String[] suffixes)
  7. EndsWith(String x, String z)
  8. endsWith(String[] endsWith, String line)
  9. endsWith(String[] searchStrings, String text)