folly::trim

Specify characters to trim.

Synopsis

Declared in <folly/String.h>

template<typename ToTrim>
StringPiece
trim(
    StringPiece sp,
    ToTrim toTrim);

Description

Returns a subpiece with all characters the provided toTrim returns true for removed from the back and front of sp.

Return Value

A subpiece with the matching leading and trailing characters removed.

Parameters

NameDescription
spThe input piece to trim.
toTrimPredicate selecting characters to remove.