// Copyright 2022 Google LLC. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #include #include namespace shaka { std::vector SplitStringIntoKeyValuePairs(std::string_view str, char kv_separator, char list_separator) { std::vector kv_pairs; // Edge case: 0 pairs. if (str.size() == 0) { return kv_pairs; } std::vector kv_strings = absl::StrSplit(str, list_separator); for (const auto& kv_string : kv_strings) { KVPair pair = absl::StrSplit(kv_string, absl::MaxSplits(kv_separator, 1)); kv_pairs.push_back(pair); } return kv_pairs; } } // namespace shaka