Here you can find the source of startsWith(String toTest, String[] possibilities)
Parameter | Description |
---|---|
toTest | the string to test |
possibilities | the strings to test against |
public static boolean startsWith(String toTest, String[] possibilities)
//package com.java2s; /*/*from www. ja va 2s . co m*/ * Ulm University DUCKS project * * Author: Elmar Schoch <elmar.schoch@uni-ulm.de> * * (C) Copyright 2006, Ulm University, all rights reserved. * * 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 2 * 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. * */ public class Main { /** * Tests whether the given string starts with one of the strings in the * array * @param toTest the string to test * @param possibilities the strings to test against * @return */ public static boolean startsWith(String toTest, String[] possibilities) { for (String p : possibilities) { if (toTest.startsWith(p)) { return true; } } return false; } }