A single character delimiter.
Synopsis
Declared in <absl/strings/str_split.h>
class ByChar;
Description
ByChar is functionally equivalent to a 1‐char string within a ByString delimiter, but slightly more efficient.
Example:
// Because a char literal is converted to a absl::ByChar, // the following two splits are equivalent. std::vector<std::string> v1 = absl::StrSplit("a,b,c", ','); using absl::ByChar; std::vector<std::string> v2 = absl::StrSplit("a,b,c", ByChar(',')); // v[0]== "a", v[1]== "b", v[2]== "c"
ByChar is also the default delimiter if a single character is given as the delimiter to StrSplit(). For example, the following calls are equivalent:
std::vector<std::string> v = absl::StrSplit("a‐b", '‐');
using absl::ByChar; std::vector<std::string> v = absl::StrSplit("a‐b", ByChar('‐'));