Here you can find the source of startsWithIgnoreCase(String p_sStr, String p_sSubStr)
Parameter | Description |
---|---|
p_sStr | string value |
p_sSubStr | sub string |
public static boolean startsWithIgnoreCase(String p_sStr, String p_sSubStr)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w .j a va 2 s . c o m * Same as {@link String#startsWith(String)}, but ignoring case * * @param p_sStr string value * @param p_sSubStr sub string * @return true, if substring */ public static boolean startsWithIgnoreCase(String p_sStr, String p_sSubStr) { if (p_sSubStr.length() > p_sStr.length()) return false; for (int i = 0; i < p_sSubStr.length(); i++) { char cSubStr = p_sSubStr.charAt(i); char cStr = p_sStr.charAt(i); char cSubStrLC = Character.toLowerCase(cSubStr); char cStrLC = Character.toLowerCase(cStr); if (cSubStrLC != cStrLC) return false; } return true; } }