| Constructor and Description |
|---|
Substring() |
| Modifier and Type | Method and Description |
|---|---|
String |
substring(String value,
String beginIndex)
Returns a string that is a substring of this string.
|
String |
substring(String value,
String beginIndex,
String endIndex)
Returns a string that is a substring of this string.
|
@FunctionInvocation public String substring(String value, String beginIndex)
Examples:
"unhappy".substring(2) returns "happy" "Harbison".substring(3) returns "bison" "emptiness".substring(9) returns "" (an empty string)
value - stringbeginIndex - the beginning index, inclusive.@FunctionInvocation public String substring(String value, String beginIndex, String endIndex)
beginIndex and
extends to the character at index endIndex - 1.
Thus the length of the substring is endIndex-beginIndex.
Examples:
"hamburger".substring(4, 8) returns "urge" "smiles".substring(1, 5) returns "mile"
value - the stringbeginIndex - the beginning index, inclusive.endIndex - the ending index, exclusiveCopyright © 2022. All rights reserved.