Java String Starts Wtih startsWithIgnoreCase(String seq, String prefix)

Here you can find the source of startsWithIgnoreCase(String seq, String prefix)

Description

Tests if the string sequence starts with the specified prefix, case insensitive.

License

Open Source License

Parameter

Parameter Description
seq a parameter
prefix a parameter

Return

true if the character sequence represented by 'prefix' is a prefix of the character sequence represented by 'seq'; false otherwise.

Declaration

public static boolean startsWithIgnoreCase(String seq, String prefix) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 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
 *
 * Contributors://from   ww w .j av  a 2  s . co  m
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * Tests if the string sequence starts with the specified prefix, case insensitive.
     * @param seq 
     * @param prefix
     * @return true if the character sequence represented by 'prefix' is a prefix of the character sequence represented by 'seq'; false otherwise. 
     */
    public static boolean startsWithIgnoreCase(String seq, String prefix) {

        return seq.toLowerCase().startsWith(prefix.toLowerCase());
    }
}

Related

  1. startsWithIgnoreCase(String s, String start)
  2. startsWithIgnoreCase(String s, String w)
  3. startsWithIgnoreCase(String searchIn, int startAt, String searchFor)
  4. startsWithIgnoreCase(String searchIn, int startAt, String searchFor)
  5. startsWithIgnoreCase(String searchIn, String searchFor)
  6. startsWithIgnoreCase(String startString, String anotherString)
  7. startsWithIgnoreCase(String str, String prefix)
  8. startsWithIgnoreCase(String str, String prefix)
  9. startsWithIgnoreCase(String str, String prefix)