Lines Matching refs:string

19 * @brief Provides the global string operation function implemented in c_utils.
28 * string replacement, trim and split etc.
33 #include <string>
40 * @brief Converts all letters in a string to uppercase.
42 * @param str Indicates the base string.
43 * @return Returns a new `std::string` object after conversion.
45 std::string UpperStr(const std::string& str);
49 * @brief Converts all letters in a string to lowercase.
51 * @param str Indicates the base string.
52 * @return Returns a new `std::string` object after conversion.
54 std::string LowerStr(const std::string& str);
58 * @brief Replaces a substring in the base string.
61 * @param src Indicates the base string.
63 * @return Returns a new `std::string` object after replacement.
65 std::string ReplaceStr(const std::string& str, const std::string& src, const std::string& dst);
69 * @brief Trims a string indicated by `cTrim` from both ends of the base string.
71 * @param str Indicates the base string.
72 * @param cTrim Indicates the string to trim from the base string, which is '' by default.
73 * @return Returns a new `std::string` object after trimming.
75 std::string TrimStr(const std::string& str, const char cTrim = ' ');
79 * @brief Converts a decimal value to a hexadecimal string.
82 * @param upper Specifies whether the output string is in uppercase.
84 * @return Returns a new `std::string` object after conversion.
86 std::string DexToHexString(int value, bool upper = true);
90 * @brief Splits a string by `sep`.
92 * @param str Indicates the base string.
95 * @param canEmpty Specifies whether the output string can be an empty string.
97 * @param needTrim Specifies whether to remove whitespace from the output string.
100 void SplitStr(const std::string& str, const std::string& sep, std::vector<std::string>& strs,
105 * @brief Converts a value of int, double, or any other type to a string.
109 * @return Returns a new `std::string` object after conversion.
112 inline std::string ToString(T iValue)
119 * @brief Converts a string to an int value.
121 * @param str Indicates the string to be converted.
126 bool StrToInt(const std::string& str, int& value);
130 * @brief Checks whether all characters in a string are numeric.
132 * @param str Indicates the base string.
133 * @return Returns `true` if all characters in the string are numeric;
136 bool IsNumericStr(const std::string& str);
140 * @brief Checks whether all characters in a string are alphabetic.
142 * @param str Indicates the base string.
143 * @return Returns `true` if all characters in the string are alphabetic;
146 bool IsAlphaStr(const std::string& str);
150 * @brief Checks whether all characters in a string are in uppercase.
152 * @param str Indicates the base string.
153 * @return Returns `true` if all characters in the string are in uppercase;
156 bool IsUpperStr(const std::string& str);
160 * @brief Checks whether all characters in a string are in lowercase.
162 * @param str Indicates the base string.
163 * @return Returns `true` if all characters in the string are in lowercase;
166 bool IsLowerStr(const std::string& str);
170 * @brief Checks whether a string contains the specified substring.
172 * @param str Indicates the base string.
174 * @return Returns `true` if the string contains the specified substring;
177 bool IsSubStr(const std::string& str, const std::string& sub);
184 * @param str Indicates the base string.
185 * @param left Indicates the left string.
186 * @param right Indicates the right string.
187 * @param sub Indicates the `std::string` object to store the result string.
189 * returns `string::npos` otherwise.
191 std::string::size_type GetFirstSubStrBetween(const std::string& str, const std::string& left,
192 const std::string& right, std::string& sub);
199 * @param str Indicates the base string.
200 * @param left Indicates the left string.
201 * @param right Indicates the right string.
204 void GetSubStrBetween(const std::string& str, const std::string& left,
205 const std::string& right, std::vector<std::string>& sub);
211 * @param first Indicates the first string to check.
212 * @param second Indicates the second string to check.
213 * @note The string is case-insensitive.
215 bool IsSameTextStr(const std::string& first, const std::string& second);
219 * @brief Checks whether all characters in a string are ASCII encoded.
221 * @param str Indicates the base string.
222 * @return Returns `true` if all characters in the string are ASCII encoded;
225 bool IsAsciiString(const std::string& str);
230 * @brief Converts a string from UTF-16 to UTF-8 encoded.
233 * @return Returns an empty `std::string` object if the operation fails.
235 std::string Str16ToStr8(const std::u16string& str16);
239 * @brief Converts a string from UTF-8 to UTF-16 encoded.
241 * @param str Indicates a `std::string` object.
244 std::u16string Str8ToStr16(const std::string& str);
257 * @brief Converts a string from UTF-16 to UTF-8 encoded.