Fabrice de Gans-Riberi | 292b0f6b | 2019-08-05 23:06:16 | [diff] [blame] | 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 | |
| 5 | #ifndef FUCHSIA_BASE_STRING_UTIL_H_ |
| 6 | #define FUCHSIA_BASE_STRING_UTIL_H_ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | #include <vector> |
| 10 | |
| 11 | #include "base/containers/span.h" |
| 12 | #include "base/strings/string_piece.h" |
| 13 | |
| 14 | namespace cr_fuchsia { |
| 15 | |
| 16 | // Creates a byte vector from a string. |
| 17 | std::vector<uint8_t> StringToBytes(base::StringPiece str); |
| 18 | |
| 19 | // Creates a string from a byte vector. |
| 20 | base::StringPiece BytesAsString(const std::vector<uint8_t>& bytes); |
| 21 | |
| 22 | } // namespace cr_fuchsia |
| 23 | |
| 24 | #endif // FUCHSIA_BASE_STRING_UTIL_H_ |