mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
dont remove null terminator in remove repetition
This commit is contained in:
parent
e453b571ba
commit
121606af14
@ -312,9 +312,9 @@ namespace Util
|
|||||||
bool RemoveRepetition(std::wstring& text)
|
bool RemoveRepetition(std::wstring& text)
|
||||||
{
|
{
|
||||||
wchar_t* end = text.data() + text.size();
|
wchar_t* end = text.data() + text.size();
|
||||||
for (int len = text.size() / 3; len > 6; --len)
|
for (int length = text.size() / 3; length > 6; --length)
|
||||||
if (wcsncmp(end - len * 3, end - len * 2, len) == 0 && wcsncmp(end - len * 3, end - len * 1, len) == 0)
|
if (wcsncmp(end - length * 3, end - length * 2, length) == 0 && wcsncmp(end - length * 3, end - length * 1, length) == 0)
|
||||||
return RemoveRepetition(text = end - len), true;
|
return RemoveRepetition(text = std::wstring(end - length, length)), true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user