Return a view of str with the given prefix removed, if present.

Synopsis

Declared in <util/string.h>

[[nodiscard]]
std::string_view
RemovePrefixView(
    std::string_view str,
    std::string_view prefix);

Return Value

A view into str without the leading prefix, or str unchanged.

Note

The return value should not be discarded.

Parameters

Name

Description

str

Input string.

prefix

Prefix to strip when str starts with it.

Created with MrDocs