Here you can find the source of startsWith(String target, String... prefixes)
public static boolean startsWith(String target, String... prefixes)
//package com.java2s; /******************************************************************************* * Copyright (c) 2007, 2008 Tran Nam Quang. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from www.java 2 s .c o m*/ * Tran Nam Quang - initial API and implementation *******************************************************************************/ public class Main { /** * Returns whether the given target string starts with one of the given prefixes. */ public static boolean startsWith(String target, String... prefixes) { for (String prefix : prefixes) if (target.startsWith(prefix)) return true; return false; } }