• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef STR_UTIL_H
17 #define STR_UTIL_H
18 #include <string>
19 #include "types.h"
20 
21 #define I18N_STRING_LENGTH_MAX 512
22 
23 namespace OHOS {
24 namespace I18N {
25 int ReplaceAndCountOff(std::string &content, const int index, const char *sign, const int off);
26 
27 void ArrayCopy(std::string *target, const int targetSize, const std::string *source, const int sourceSize);
28 
29 char *NewArrayAndCopy(const char *source, const int len);
30 
31 char *I18nNewCharString(const char *source, const int len);
32 
33 bool CleanCharArray(char *target, const int len);
34 
35 int LenCharArray(const char *target);
36 
37 void Split(const std::string &src, std::string *dst, const int32_t size, const char &sep);
38 
39 bool CompareLocaleItem(const char *src, const char *dst);
40 
41 std::string Parse(const char *str, int32_t count);
42 } // namespace I18N
43 } // namespace OHOS
44 #endif