Here you can find the source of startsWithMultiple(String string, String... starts)
Parameter | Description |
---|---|
string | Input string. |
starts | Values to check. |
public static boolean startsWithMultiple(String string, String... starts)
//package com.java2s; /*/* w w w. j a v a 2 s. c o m*/ * StBukkitLib * Copyright (C) 2014 Stealth2800 <stealth2800@stealthyone.com> * Website: <http://stealthyone.com/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Checks if the input string starts with any of the values. * * @param string Input string. * @param starts Values to check. * @return True if the input string starts with any of the given values. * False if none of the values begin the input string. */ public static boolean startsWithMultiple(String string, String... starts) { for (String start : starts) { if (string.startsWith(start)) { return true; } } return false; } }