Here you can find the source of startsWithIgnoreCase(String haystack, String needle)
Parameter | Description |
---|---|
haystack | - string to search |
needle | - string to look for - must be in lowercase |
public static boolean startsWithIgnoreCase(String haystack, String needle)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a va2 s .co m*/ * * @param haystack - string to search * @param needle - string to look for - must be in lowercase * @return */ public static boolean startsWithIgnoreCase(String haystack, String needle) { if (haystack.length() < needle.length()) { return false; } for (int i = 0; i < needle.length(); i++) { if (Character.toLowerCase(haystack.charAt(i)) != needle.charAt(i)) { return false; } } return true; } }