ZXFoundation™ 26h2
Loading...
Searching...
No Matches
string_parser.cxxm File Reference

Zero-allocation, high-performance string tokenizer. More...

import std;
import zxfoundation.base.types;
Include dependency graph for string_parser.cxxm:

Data Structures

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

Functions

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 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 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.

Detailed Description

Zero-allocation, high-performance string tokenizer.

SPDX-License-Identifier: Apache 2.0

Function Documentation

◆ rsplit()

auto lib::rsplit ( std::string_view s,
std::string_view delim )->std::pair< std::string_view, std::string_view >
inlinenodiscardexportnoexcept

Split s at the last occurrence of delim.

Returns
Pair (before, after). after is empty if delim not found.

◆ split()

auto lib::split ( std::string_view s,
std::string_view delim )->std::pair< std::string_view, std::string_view >
inlinenodiscardexportnoexcept

Split s at the first occurrence of delim.

Returns
Pair (before, after). after is empty if delim not found.

◆ unquote()

auto lib::unquote ( std::string_view s) ->std::string_view
inlinenodiscardexportnoexcept

Remove matching surrounding quotes from s.

Returns
Unquoted view, or s unchanged if not quoted.