Java String Starts Wtih startsWithIgnoreCase(String[] compoundName, String[] prefix)

Here you can find the source of startsWithIgnoreCase(String[] compoundName, String[] prefix)

Description

starts With Ignore Case

License

Open Source License

Declaration

public static boolean startsWithIgnoreCase(String[] compoundName, String[] prefix) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2016 IBM Corporation 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
 *
 *******************************************************************************/

public class Main {
    public static boolean startsWithIgnoreCase(String[] compoundName, String[] prefix) {
        int prefixLength = prefix.length;
        int nameLength = compoundName.length;
        if (prefixLength > nameLength)
            return false;
        for (int i = 0; i < prefixLength - 1; i++) {
            if (!compoundName[i].equalsIgnoreCase(prefix[i]))
                return false;
        }//from   www .ja  v  a  2 s  .  c om
        return compoundName[prefixLength - 1].toLowerCase().startsWith(prefix[prefixLength - 1].toLowerCase());
    }
}

Related

  1. startsWithIgnoreCase(String string1, String string2)
  2. startsWithIgnoreCase(String text, String prefix)
  3. startsWithIgnoreCase(String text, String value)
  4. startsWithIgnoreCase(String thisString, String prefix)
  5. startsWithIgnoreCase(String whole, String prefix)
  6. startsWithIgnoreCaseAndNonAlphaNumeric(String searchIn, String searchFor)
  7. startsWithIgnoreCaseAndWs(String searchIn, String searchFor)
  8. startsWithIgnoreCaseAndWs(String searchIn, String searchFor, int beginPos)
  9. startsWithIgnoreWhitespace(String str, String prefix)