Java String Starts Wtih startsWith(String[] beginningSegments, String[] testSegments)

Here you can find the source of startsWith(String[] beginningSegments, String[] testSegments)

Description

starts With

License

Open Source License

Return

True if beginningSegments[i] == testSegments[i] for all 0<=iDeclaration
private static boolean startsWith(String[] beginningSegments,
        String[] testSegments) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009 Red Hat and others.
 * 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://w  w  w  .  j a v  a 2s  . c  o  m
 *     Red Hat - Initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * @return True if beginningSegments[i] == testSegments[i] for all 0<=i<beginningSegments[i] 
     */
    private static boolean startsWith(String[] beginningSegments,
            String[] testSegments) {
        for (int i = 0; i < beginningSegments.length; i++) {
            if (!beginningSegments[i].equals(testSegments[i]))
                return false;
        }
        return true;
    }
}

Related

  1. startsWith(String target, String... prefixes)
  2. startsWith(String text, String prefix, int toffset)
  3. startsWith(String toTest, String[] possibilities)
  4. startsWith(String value, String startsWith)
  5. startsWith(String[] array, String obj)
  6. startsWith(String[] searchStrings, String text)
  7. startsWith(String[] target, String[] with)
  8. startsWith(StringBuffer buffer, String prefix)
  9. startsWith(StringBuilder builder, String prefix, int offset)