mirror of
https://github.com/openharmony/utils_native.git
synced 2026-07-21 01:25:42 -04:00
@@ -118,13 +118,13 @@ bool IsAsciiString(const std::string& str);
|
||||
|
||||
/**
|
||||
* The str16ToStr8 function convert string16 to string8.
|
||||
* If covert failed, return an empty string.
|
||||
* If convert failed, return an empty string.
|
||||
*/
|
||||
std::string Str16ToStr8(const std::u16string& str16);
|
||||
|
||||
/**
|
||||
* The Str8ToStr16 function convert string8 to string16.
|
||||
* If covert failed, return an empty u16string.
|
||||
* If convert failed, return an empty u16string.
|
||||
*/
|
||||
std::u16string Str8ToStr16(const std::string& str);
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -216,14 +216,12 @@ string::size_type GetFirstSubStrBetween(const string& str, const string& left,
|
||||
void GetSubStrBetween(const string& str, const string& left, const string& right, vector<string>& sub)
|
||||
{
|
||||
string subString;
|
||||
string::size_type pos = 0;
|
||||
string strTmp = str;
|
||||
string::size_type pos = GetFirstSubStrBetween(strTmp, left, right, subString);
|
||||
while (pos != string::npos) {
|
||||
sub.push_back(subString);
|
||||
strTmp = strTmp.substr(pos);
|
||||
pos = GetFirstSubStrBetween(strTmp, left, right, subString);
|
||||
if (pos != string::npos) {
|
||||
sub.push_back(subString);
|
||||
strTmp = strTmp.substr(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user