The StringUtils startsWithIgnoreCase method is a part of the org.apache.commons.lang3 package library in Java. This method checks if the given string starts with the specified prefix, ignoring case sensitivity.
Example 1:
String str = "Hello World";
boolean result = StringUtils.startsWithIgnoreCase(str, "h");
System.out.println(result); // Output: true
In this example, we have defined a string "Hello World" and checked if it starts with "h" using startsWithIgnoreCase. Since it is case-insensitive, it returns true.
Example 2:
String str = "Java Programming";
boolean result = StringUtils.startsWithIgnoreCase(str, "JAVA");
System.out.println(result); // Output: true
In this example, we have defined a string "Java Programming" and checked if it starts with "JAVA" using startsWithIgnoreCase. Though the case doesn't match, it returns true as it ignores case sensitivity.
Overall, StringUtils startsWithIgnoreCase method is useful in scenarios where we want to check for a prefix in a string while ignoring case sensitivity. It is a part of the org.apache.commons.lang3 package library.
Java StringUtils.startsWithIgnoreCase - 15 examples found. These are the top rated real world Java examples of org.apache.commons.lang3.StringUtils.startsWithIgnoreCase extracted from open source projects. You can rate examples to help us improve the quality of examples.