Here you can find the source of startsWithIgnoreCase(final String input, final String prefix)
Parameter | Description |
---|---|
input | string to check |
prefix | suffix to check |
Parameter | Description |
---|---|
IllegalArgumentException | if Input or Suffix is null |
public static boolean startsWithIgnoreCase(final String input, final String prefix)
//package com.java2s; //License from project: Creative Commons License public class Main { /**//www. j ava 2 s . c o m * Checks if a string starts with a given suffix. * @param input string to check * @param prefix suffix to check * @return true if string starts with a given suffix * @throws IllegalArgumentException if Input or Suffix is null */ public static boolean startsWithIgnoreCase(final String input, final String prefix) { if (input == null) throw new IllegalArgumentException("Input cannot be null!"); if (prefix == null) throw new IllegalArgumentException("Suffix cannot be null!"); return input.startsWith(prefix) || input.length() >= prefix.length() && input.toLowerCase().startsWith(prefix.toLowerCase()); } }