mirror of
https://github.com/ReMinecraftPE/mcpe.git
synced 2025-01-23 17:52:10 -05:00
* Fix Util::stringTrim. Not sure if accurate
This commit is contained in:
parent
adf3dfa54e
commit
35773b5ba6
1 changed files with 7 additions and 43 deletions
|
@ -17,61 +17,25 @@ std::string Util::stringTrim(const std::string& str, const std::string& filter,
|
|||
if (!a4 && !a5)
|
||||
return "";
|
||||
|
||||
int v12, strIndex = 0, v13, v17, strLength = int(str.size()), filterLength = int(filter.size());
|
||||
int startIndex = 0, endIndex = int(str.size()) - 1;
|
||||
|
||||
// @TODO: This ain't working man
|
||||
if (a4)
|
||||
{
|
||||
v12 = strLength - 1;
|
||||
if (strLength > 0)
|
||||
while (startIndex < endIndex && strchr(filter.c_str(), str[startIndex]))
|
||||
{
|
||||
v17 = strLength - 1;
|
||||
do
|
||||
{
|
||||
const void* v14 = memchr(filter.c_str(), str[strIndex], filterLength);
|
||||
if (!v14)
|
||||
{
|
||||
v13 = strIndex;
|
||||
v12 = v17;
|
||||
goto label_12;
|
||||
}
|
||||
|
||||
++strIndex;
|
||||
} while (strIndex != strLength);
|
||||
|
||||
v12 = strLength - 1;
|
||||
v13 = strIndex;
|
||||
startIndex++;
|
||||
}
|
||||
else v13 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a5)
|
||||
{
|
||||
v12 = strLength - 1;
|
||||
strIndex = 0;
|
||||
v13 = 0;
|
||||
|
||||
goto label_19;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
label_12:
|
||||
if (a5)
|
||||
{
|
||||
v13 = strIndex;
|
||||
label_19:
|
||||
while (v12 >= strIndex)
|
||||
while (startIndex < endIndex && strchr(filter.c_str(), str[endIndex]))
|
||||
{
|
||||
const void* v15 = memchr(filter.c_str(), str[strIndex], filterLength);
|
||||
if (!v15)
|
||||
break;
|
||||
--v12;
|
||||
endIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
return std::string(str, v13, v12 - 1 + strIndex);
|
||||
return str.substr(startIndex, endIndex + 1 - startIndex);
|
||||
}
|
||||
|
||||
std::string Util::stringTrim(const std::string& str)
|
||||
|
|
Loading…
Add table
Reference in a new issue