Shaka Packager SDK
string_trim_split.cc
1 // Copyright 2023 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include <packager/utils/string_trim_split.h>
8 
9 #include <absl/strings/str_split.h>
10 
11 namespace shaka {
12 std::vector<std::string> SplitAndTrimSkipEmpty(const std::string& str,
13  char delimiter) {
14  auto tokens = absl::StrSplit(str, delimiter, absl::SkipEmpty());
15  std::vector<std::string> results;
16  for (const absl::string_view& token : tokens) {
17  std::string trimmed = std::string(token);
18  absl::StripAsciiWhitespace(&trimmed);
19  if (!trimmed.empty()) {
20  results.push_back(trimmed);
21  }
22  }
23 
24  return results;
25 }
26 } // namespace shaka
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66