100600bfbSopenharmony_ci/*
200600bfbSopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd.
300600bfbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
400600bfbSopenharmony_ci * you may not use this file except in compliance with the License.
500600bfbSopenharmony_ci * You may obtain a copy of the License at
600600bfbSopenharmony_ci *
700600bfbSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
800600bfbSopenharmony_ci *
900600bfbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1000600bfbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1100600bfbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200600bfbSopenharmony_ci * See the License for the specific language governing permissions and
1300600bfbSopenharmony_ci * limitations under the License.
1400600bfbSopenharmony_ci */
1500600bfbSopenharmony_ci#ifndef STRING_UTILS_H
1600600bfbSopenharmony_ci#define STRING_UTILS_H
1700600bfbSopenharmony_ci#include <string>
1800600bfbSopenharmony_ci#include <vector>
1900600bfbSopenharmony_ci#include "singleton.h"
2000600bfbSopenharmony_cinamespace OHOS {
2100600bfbSopenharmony_cinamespace HiviewDFX {
2200600bfbSopenharmony_ciclass StringUtils : public Singleton<StringUtils> {
2300600bfbSopenharmony_cipublic:
2400600bfbSopenharmony_ci    StringUtils();
2500600bfbSopenharmony_ci    ~StringUtils();
2600600bfbSopenharmony_ci    StringUtils(StringUtils const &) = delete;
2700600bfbSopenharmony_ci    void operator=(StringUtils const &) = delete;
2800600bfbSopenharmony_ci
2900600bfbSopenharmony_ci    void StringSplit(const std::string &str, const std::string &split, std::vector<std::string> &result);
3000600bfbSopenharmony_ci    bool IsBegin(const std::string &content, const std::string &begin);
3100600bfbSopenharmony_ci    bool IsEnd(const std::string &content, const std::string &end);
3200600bfbSopenharmony_ci    bool IsContain(const std::string &content, const std::string &contain);
3300600bfbSopenharmony_ci    bool IsSameStr(const std::string &first, const std::string &second);
3400600bfbSopenharmony_ci    void ReplaceAll(std::string &str, const std::string &oldValue, const std::string &newValue);
3500600bfbSopenharmony_ci    bool IsNum(std::string str);
3600600bfbSopenharmony_ci    void HexToDec(const std::string &str, uint64_t &value);
3700600bfbSopenharmony_ci    void SetWidth(const int &width, const char &fileStr, const bool &left, std::string &str);
3800600bfbSopenharmony_ci    char GetBlank();
3900600bfbSopenharmony_ci    char GetSeparator();
4000600bfbSopenharmony_ci
4100600bfbSopenharmony_ciprivate:
4200600bfbSopenharmony_ci    const int HEX_STR = 16;
4300600bfbSopenharmony_ci    const int DEC_STR = 10;
4400600bfbSopenharmony_ci};
4500600bfbSopenharmony_ci} // namespace HiviewDFX
4600600bfbSopenharmony_ci} // namespace OHOS
4700600bfbSopenharmony_ci#endif