[#bsl-basic_string-0faf-substr-0d9] = xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic_string]::substr :relfileprefix: ../../ :mrdocs: Return a substring of this string as a const lvalue. == Synopsis Declared in `<bslstl_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_string-0faf.adoc[basic_string] substr( xref:bsl/basic_string-0faf/size_type.adoc[size_type] position = 0, xref:bsl/basic_string-0faf/size_type.adoc[size_type] numChars = npos) const &; ---- == Description 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). == Return Value substring of this string == Parameters [cols="1,4"] |=== | Name| Description | *position* | starting index | *numChars* | number of characters |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#