1e5d0e473Sopenharmony_ci/* 2e5d0e473Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 3e5d0e473Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e5d0e473Sopenharmony_ci * you may not use this file except in compliance with the License. 5e5d0e473Sopenharmony_ci * You may obtain a copy of the License at 6e5d0e473Sopenharmony_ci * 7e5d0e473Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e5d0e473Sopenharmony_ci * 9e5d0e473Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e5d0e473Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e5d0e473Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e5d0e473Sopenharmony_ci * See the License for the specific language governing permissions and 13e5d0e473Sopenharmony_ci * limitations under the License. 14e5d0e473Sopenharmony_ci */ 15e5d0e473Sopenharmony_ci 16e5d0e473Sopenharmony_ci#ifndef STRING_UTILS_H 17e5d0e473Sopenharmony_ci#define STRING_UTILS_H 18e5d0e473Sopenharmony_ci 19e5d0e473Sopenharmony_ci#include <string> 20e5d0e473Sopenharmony_ci#include <vector> 21e5d0e473Sopenharmony_ci 22e5d0e473Sopenharmony_ci#include "cstdint" 23e5d0e473Sopenharmony_ci#include "iosfwd" 24e5d0e473Sopenharmony_cinamespace OHOS { 25e5d0e473Sopenharmony_cinamespace Telephony { 26e5d0e473Sopenharmony_ciclass StringUtils { 27e5d0e473Sopenharmony_cipublic: 28e5d0e473Sopenharmony_ci static std::string StringToHex(const std::string &data); 29e5d0e473Sopenharmony_ci static std::string HexToString(const std::string &str); 30e5d0e473Sopenharmony_ci static std::string StringToHex(const char *data, int byteLength); 31e5d0e473Sopenharmony_ci static std::string ToUtf8(const std::u16string &str16); 32e5d0e473Sopenharmony_ci static std::u16string ToUtf16(const std::string &str); 33e5d0e473Sopenharmony_ci static std::string StringToHex(const std::vector<uint8_t> &data); 34e5d0e473Sopenharmony_ci static std::vector<uint8_t> HexToByteVector(const std::string &str); 35e5d0e473Sopenharmony_ci static bool IsEmpty(const std::string &str); 36e5d0e473Sopenharmony_ci 37e5d0e473Sopenharmony_ciprivate: 38e5d0e473Sopenharmony_ci StringUtils(); 39e5d0e473Sopenharmony_ci virtual ~StringUtils(); 40e5d0e473Sopenharmony_ci static uint16_t HexCharToInt(char c); 41e5d0e473Sopenharmony_ci}; 42e5d0e473Sopenharmony_ci} // namespace Telephony 43e5d0e473Sopenharmony_ci} // namespace OHOS 44e5d0e473Sopenharmony_ci#endif