Provide a section of a string as a substring.
String |
The substring() method retrieves a portion of the string.
If the end parameter is omitted, the substring extends to the end of the string.
One of the following:
public |
public |
Parameter |
Description |
start |
Necessary: The index indicating the character where the substring begins. |
end |
Necessary: The index indicating the character where the substring begins. |
Returns |
A string that contains a portion of the original string as a substring. |
Throws |
The IndexOutOfBoundsException occurs if either the start or end values are negative, exceed the length of the string, or if start is greater than end. |
Java Version |
Any. |