Here you can find the source of startsWithIgnoreCase(String a, String b)
true
if a
starts with b
regardless of the case.
Parameter | Description |
---|---|
a | string to test. |
b | prefix to test for. |
true
if a
starts with b
regardless of the case, false
otherwise..
public static boolean startsWithIgnoreCase(String a, String b)
//package com.java2s; /*//from ww w . j a va 2 s . co m * This file is part of muCommander, http://www.mucommander.com * Copyright (C) 2002-2010 Maxence Bernard * * muCommander 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 3 of the License, or * (at your option) any later version. * * muCommander 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Returns <code>true</code> if <code>a</code> starts with <code>b</code> regardless of the case. * <p> * Note that this method will return <code>true</code> if <code>b</code> is an emptry string. * </p> * @param a string to test. * @param b prefix to test for. * @return <code>true</code> if <code>a</code> starts with <code>b</code> regardless of the case, <code>false</code> otherwise.. */ public static boolean startsWithIgnoreCase(String a, String b) { return a.regionMatches(true, 0, b, 0, b.length()); } }