[string.substr]

# 27 Strings library [[strings]](./#strings)

## 27.4 String classes [[string.classes]](string.classes#string.substr)

### 27.4.3 Class template basic_string [[basic.string]](basic.string#string.substr)

#### 27.4.3.8 String operations [[string.ops]](string.ops#string.substr)

#### 27.4.3.8.3 basic_string​::​substr [string.substr]

[ð](#lib:substr,basic_string)

`constexpr basic_string substr(size_type pos = 0, size_type n = npos) const &;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4463)

*Effects*: Equivalent to: return basic_string(*this, pos, n);

[ð](#lib:substr,basic_string_)

`constexpr basic_string substr(size_type pos = 0, size_type n = npos) &&;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4474)

*Effects*: Equivalent to: return basic_string(std​::​move(*this), pos, n);

[ð](#lib:subview,basic_string)

`constexpr basic_string_view<charT, traits> subview(size_type pos = 0, size_type n = npos) const;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L4485)

*Effects*: Equivalent to: return basic_string_view<charT, traits>(*this).subview(pos, n);
