StringUtils is a class in org.apache.commons.lang library that provides various utility methods for manipulating strings. One such method is removeStart which is used to remove a specific string from the start of another string.
Syntax:
public static String removeStart(String str, String remove)
Description:
The removeStart method takes two arguments:
- str: The string from which the specified string is to be removed. - remove: The string to be removed from the start of the str.
Example 1: Using removeStart to remove a specific prefix from a string.
In this example, the removeStart method removes the prefix "Hello, " from the string "Hello, World!" and returns the remaining string "World!".
Example 2: Using removeStart to remove a substring from a string.
String str2 = "Java is a popular programming language."; String toRemove = "pular"; String result = StringUtils.removeStart(str2, toRemove); System.out.println(result); //Output: Java is a opgramming language.
In this example, the removeStart method removes the substring "pular" from the string "Java is a popular programming language." and returns the remaining string "Java is a opgramming language."
Java StringUtils.removeStart - 30 examples found. These are the top rated real world Java examples of org.apache.commons.lang.StringUtils.removeStart extracted from open source projects. You can rate examples to help us improve the quality of examples.