mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-14 15:04:09 +00:00
add doc: substr
This commit is contained in:
parent
5f453b10f6
commit
8abdca1749
16 changed files with 1187 additions and 15 deletions
44
source/libs/string/basic_string/substr.rst
Normal file
44
source/libs/string/basic_string/substr.rst
Normal file
|
@ -0,0 +1,44 @@
|
|||
.. _sprout-string-basic_string-substr:
|
||||
###############################################################################
|
||||
substr
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
SPROUT_CONSTEXPR basic_string substr(size_type pos = 0, size_type n = npos) const;
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| ``pos <= size()``.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| ``basic_string(data() + pos, rlen)`` when rlen is the smaller of n and ``size() - pos``.
|
||||
|
||||
Throws
|
||||
========================================
|
||||
|
||||
| std::out_of_range if ``pos > size()``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/string.hpp>
|
||||
#include <sprout/assert.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
|
||||
SPROUT_STATIC_CONSTEXPR auto y = x.substr(4, 4);
|
||||
SPROUT_ASSERT_MASG(y == "homu", "y is substring of x.");
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/string/string.hpp``
|
||||
| Convenience header: ``sprout/string.hpp``
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue