FastLED 3.9.15
Loading...
Searching...
No Matches

◆ substr() [2/2]

string fl::string::substr ( fl::size start,
fl::size length ) const

Definition at line 161 of file string.cpp.hpp.

161 {
162 // Handle `npos` / overflow: when `length == npos` the caller
163 // means "to end of string", and when `length` is large enough
164 // that `start + length` would wrap, we clamp to the end before
165 // the addition can overflow.
166 fl::size end;
167 if (length == npos || length > size() - (start < size() ? start : size())) {
168 end = size();
169 } else {
170 end = start + length;
171 if (end > size()) end = size();
172 }
173 return substring(start, end);
174}
fl::size length() const FL_NOEXCEPT
iterator end() FL_NOEXCEPT
fl::size size() const FL_NOEXCEPT
string substring(fl::size start, fl::size end) const FL_NOEXCEPT
static constexpr fl::size npos
Definition string.h:195

References fl::basic_string::end(), FL_NOEXCEPT, fl::basic_string::length(), npos, fl::basic_string::size(), and substring().

Referenced by fl::validation::formatSummaryTable(), fl::anonymous_namespace{http_parser.cpp.hpp}::http_parser_trim(), fl::net::http::ChunkedReader::parseChunkSize(), fl::HttpRequestParser::parseHeaders(), fl::HttpResponseParser::parseHeaders(), fl::HttpRequestParser::parseRequestLine(), fl::wled::parseSegmentFields(), fl::HttpResponseParser::parseStatusLine(), test_await_approach(), test_ping_endpoint(), and test_promise_approach().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: