ZXFoundation™ 26h2
Loading...
Searching...
No Matches
lib.string_parser Module Reference

Data Structures

class  lib::tokenizer
 Zero-allocation streaming string tokenizer. More...

Functions

auto empty () const noexcept -> bool
 True when all input has been consumed.
auto next () noexcept -> std::optional< std::string_view >
 Extract the next token.
auto next_pair () noexcept -> std::optional< std::pair< std::string_view, std::string_view > >
 Parse the next token as a key=value pair.
auto peek () noexcept -> std::optional< std::string_view >
 Peek at the next token without consuming it.
auto remaining () const noexcept -> std::string_view
 Return the unconsumed portion of the input.
auto reset (std::string_view input) noexcept -> void
 Reset with a new input string.
auto lib::rsplit (std::string_view s, std::string_view delim) noexcept -> std::pair< std::string_view, std::string_view >
 Split s at the last occurrence of delim.
auto seek (usize pos) noexcept -> void
 Seek to a previously saved position.
auto lib::split (std::string_view s, std::string_view delim) noexcept -> std::pair< std::string_view, std::string_view >
 Split s at the first occurrence of delim.
auto tell () const noexcept -> usize
 Return the current read position.
 tokenizer (std::string_view input, std::string_view delimiters=" \t\r\n") noexcept
 Construct a tokenizer over input.
auto lib::trim (std::string_view s) noexcept -> std::string_view
 Trim leading and trailing whitespace (space, tab, newline, CR).
auto lib::unquote (std::string_view s) noexcept -> std::string_view
 Remove matching surrounding quotes from s.

Files

file  lib/string_parser.cxxm
 Zero-allocation, high-performance string tokenizer.