Java String Starts Wtih startsWithAny(String text, String... prefixes)

Here you can find the source of startsWithAny(String text, String... prefixes)

Description

Return whether the non-null text arg starts with any of the prefix values.

License

BSD License

Parameter

Parameter Description
text a parameter
prefixes a parameter

Return

boolean

Declaration

public static boolean startsWithAny(String text, String... prefixes) 

Method Source Code

//package com.java2s;
/**/*from   w ww  .ja  v  a 2 s.c o m*/
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

public class Main {
    /**
     * Return whether the non-null text arg starts with any of the prefix
     * values.
     *
     * @param text
     * @param prefixes
     * @return boolean
     */
    public static boolean startsWithAny(String text, String... prefixes) {

        for (String prefix : prefixes) {
            if (text.startsWith(prefix)) {
                return true;
            }
        }

        return false;
    }
}

Related

  1. startsWithAny(String _str, String... _startStrings)
  2. startsWithAny(String s, String... options)
  3. startsWithAny(String source, String[] checks)
  4. startsWithAny(String str, String... args)
  5. startsWithAny(String stringToMatch, String... stringToCheckEquals)
  6. startsWithAny(String toMatch, String... startsWithAny)
  7. startsWithAnyCI(String string, String... prefixes)
  8. startsWithAnyCS(String str, String[] needles)
  9. startsWithAnyIgnoreCase(String s, String... options)