string_split_win.cc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/strings/string_split_win.h"
  5. #include <string>
  6. #include <vector>
  7. #include "base/strings/string_piece.h"
  8. #include "base/strings/string_split_internal.h"
  9. namespace base {
  10. namespace internal {
  11. template <>
  12. inline WStringPiece WhitespaceForType<wchar_t>() {
  13. return kWhitespaceWide;
  14. }
  15. } // namespace internal
  16. std::vector<std::wstring> SplitString(WStringPiece input,
  17. WStringPiece separators,
  18. WhitespaceHandling whitespace,
  19. SplitResult result_type) {
  20. return internal::SplitStringT<std::wstring>(input, separators, whitespace,
  21. result_type);
  22. }
  23. std::vector<WStringPiece> SplitStringPiece(WStringPiece input,
  24. WStringPiece separators,
  25. WhitespaceHandling whitespace,
  26. SplitResult result_type) {
  27. return internal::SplitStringT<WStringPiece>(input, separators, whitespace,
  28. result_type);
  29. }
  30. std::vector<std::wstring> SplitStringUsingSubstr(WStringPiece input,
  31. WStringPiece delimiter,
  32. WhitespaceHandling whitespace,
  33. SplitResult result_type) {
  34. return internal::SplitStringUsingSubstrT<std::wstring>(
  35. input, delimiter, whitespace, result_type);
  36. }
  37. std::vector<WStringPiece> SplitStringPieceUsingSubstr(
  38. WStringPiece input,
  39. WStringPiece delimiter,
  40. WhitespaceHandling whitespace,
  41. SplitResult result_type) {
  42. return internal::SplitStringUsingSubstrT<WStringPiece>(
  43. input, delimiter, whitespace, result_type);
  44. }
  45. } // namespace base