Here you can find the source of startsWithIgnoreCase(final String source, final String target)
Parameter | Description |
---|---|
source | string to be tested. |
target | string to be tested. |
public static boolean startsWithIgnoreCase(final String source, final String target)
//package com.java2s; //License from project: Apache License public class Main { /**// w ww . j av a 2 s . c o m * Returns true if given source string start with target string ignore case * sensitive; false otherwise. * * @param source string to be tested. * @param target string to be tested. * @return true if given source string start with target string ignore case * sensitive; false otherwise. */ public static boolean startsWithIgnoreCase(final String source, final String target) { if (source.startsWith(target)) { return true; } if (source.length() < target.length()) { return false; } return source.substring(0, target.length()).equalsIgnoreCase(target); } }