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 #include <string> 17 #include <vector> 18 19 namespace OHOS { 20 /** 21 * The IsNumericStr function judge all characters of the string are numbers, 22 * return true if all are numbers, else false. 23 */ 24 bool IsNumericStr(const std::string& str); 25 26 /** 27 * The TrimStr function will trim str by cTrim front and end. 28 */ 29 std::string TrimStr(const std::string& str, const char cTrim = ' '); 30 31 /** 32 * The UpperStr function convert all letters of str to uppercase. 33 */ 34 std::string UpperStr(const std::string& str); 35 36 /** 37 * The SplitStr function will split str by strSep. 38 */ 39 void SplitStr(const std::string& str, const std::string& sep, std::vector<std::string>& strs, 40 bool canEmpty = false, bool needTrim = true); 41 42 /** 43 * The IsSameTextStr function judge the first's letter is same with second, 44 * return true if same, else false. 45 */ 46 bool IsSameTextStr(const std::string& first, const std::string& second); 47 } 48