Lines Matching refs:string
31 string UpperStr(const string& str)
33 string upperString = str;
38 string LowerStr(const string& str)
40 string lowerString = str;
45 string ReplaceStr(const string& str, const string& src, const string& dst)
51 string::size_type pos = 0;
52 string strTmp = str;
53 while ((pos = strTmp.find(src, pos)) != string::npos) {
61 string TrimStr(const string& str, const char cTrim /*= ' '*/)
64 return string{};
67 string strTmp = str;
68 std::string::size_type firstBound = strTmp.find_first_not_of(cTrim);
69 if (firstBound != std::string::npos) {
73 std::string::size_type lastBound = strTmp.find_last_not_of(cTrim);
74 if (lastBound != std::string::npos && lastBound != strTmp.size() - 1) {
81 string DexToHexString(int value, bool upper /*= true*/)
84 string hexString;
95 void SplitStr(const string& str, const string& sep, vector<string>& strs, bool canEmpty, bool needTrim)
98 string strTmp = needTrim ? TrimStr(str) : str;
99 string strPart;
101 string::size_type pos = strTmp.find(sep);
102 if (string::npos == pos || sep.empty()) {
118 bool StrToInt(const string& str, int& value)
136 bool IsNumericStr(const string& str)
151 bool IsAlphaStr(const string& str)
166 bool IsUpperStr(const string& str)
181 bool IsLowerStr(const string& str)
196 bool IsSubStr(const string& str, const string& sub)
202 return str.find(sub) != string::npos;
205 string::size_type GetFirstSubStrBetween(const string& str, const string& left,
206 const string& right, string& sub)
208 string::size_type leftPos = str.find(left);
209 if (leftPos == string::npos) {
210 return string::npos;
213 string::size_type rightPos = str.find(right, leftPos + left.length());
214 if (rightPos == string::npos) {
215 return string::npos;
222 void GetSubStrBetween(const string& str, const string& left, const string& right, vector<string>& sub)
224 string subString;
225 string strTmp = str;
226 string::size_type pos = GetFirstSubStrBetween(strTmp, left, right, subString);
227 while (pos != string::npos) {
234 bool IsSameTextStr(const string& first, const string& second)
246 bool IsAsciiString(const string& str)
259 u16string Str8ToStr16(const string& str)
269 string Str16ToStr8(const u16string& str16)
271 string str8Value;
273 return string();