aboutsummaryrefslogtreecommitdiff
path: root/absl/strings/str_split.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/str_split.h')
-rw-r--r--absl/strings/str_split.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/absl/strings/str_split.h b/absl/strings/str_split.h
index 7bbb68a3..87540278 100644
--- a/absl/strings/str_split.h
+++ b/absl/strings/str_split.h
@@ -130,6 +130,24 @@ class ByString {
const std::string delimiter_;
};
+// ByAsciiWhitespace
+//
+// A sub-string delimiter that splits by ASCII whitespace
+// (space, tab, vertical tab, formfeed, linefeed, or carriage return).
+// Note: you probably want to use absl::SkipEmpty() as well!
+//
+// This class is equivalent to ByAnyChar with ASCII whitespace chars.
+//
+// Example:
+//
+// std::vector<std::string> v = absl::StrSplit(
+// "a b\tc\n d \n", absl::ByAsciiWhitespace(), absl::SkipEmpty());
+// // v[0] == "a", v[1] == "b", v[2] == "c", v[3] == "d"
+class ByAsciiWhitespace {
+ public:
+ absl::string_view Find(absl::string_view text, size_t pos) const;
+};
+
// ByChar
//
// A single character delimiter. `ByChar` is functionally equivalent to a