Return a substring of this string as a const lvalue.
Declared in <bslstl_string.h>
basic_string
substr(
size_type position = 0,
size_type numChars = npos) const &;
Return a string whose value is the substring starting at the optionally specified position in this string, of length the optionally specified numChars or length() - position, whichever is smaller. If position is not specified, 0 is used (i.e., the substring is from the beginning of this string). If numChars is not specified, npos is used (i.e., the entire suffix from position to the end of the string is returned).
substring of this string
| Name | Description |
|---|---|
| position | starting index |
| numChars | number of characters |