llvm::StringRef::slice

Return a reference to the substring from [Start, End).]

Synopsis

Declared in <llvm/ADT/StringRef.h>

[[nodiscard]]
StringRef
slice(
    size_t Start,
    size_t End) const;

Return Value

Substring covering characters in [Start, End).]

NOTE

The return value should not be discarded.

Parameters

NameDescription
StartThe index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
EndThe index following the last character to include in the substring. If this is npos or exceeds the number of characters remaining in the string, the string suffix (starting with Start) will be returned. If this is less than Start, an empty string will be returned.