![]() |
VOOZH | about |
delete(int start, int end) method in the StringBuilder class is used to remove a portion of the string, starting from the specified start index to the specified end index. This method is used to modify mutable sequences of characters.
Example 1: The below example demonstrates how to use the delete() method to remove a substring from a given start index to an end index.
Hello, !
public StringBuilder delete(int start, int end)
Parameters:
Return Value: It returns the StringBuilder object after deleting the specified portion of the string.
Example 2: Here, we use the delete() method to delete a substring from a string between a start index and an end index.
Javang
Example 3: Here, we use delete() method to delete a substring from a specific index to the end of the string.
Hello,
Example 4: Here, we use delete() to delete the substring from the start of the string to a specific index in the middle.
the first part