string_util.h 583 B

12345678910111213141516171819
  1. // Copyright 2019 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. #ifndef FUCHSIA_WEB_COMMON_STRING_UTIL_H_
  5. #define FUCHSIA_WEB_COMMON_STRING_UTIL_H_
  6. #include <cstdint>
  7. #include <vector>
  8. #include "base/strings/string_piece.h"
  9. // Creates a byte vector from a string.
  10. std::vector<uint8_t> StringToBytes(base::StringPiece str);
  11. // Creates a string from a byte vector.
  12. base::StringPiece BytesAsString(const std::vector<uint8_t>& bytes);
  13. #endif // FUCHSIA_WEB_COMMON_STRING_UTIL_H_