AK: Ensure StringBuilder capacity in String::reverse

This commit is contained in:
Idan Horowitz 2021-06-29 17:50:37 +03:00 committed by Linus Groh
parent 4a2a084789
commit a768131720
Notes: sideshowbarker 2024-07-18 11:20:49 +09:00

View file

@ -358,7 +358,7 @@ size_t String::count(const String& needle) const
String String::reverse() const
{
StringBuilder reversed_string;
StringBuilder reversed_string(length());
for (size_t i = length(); i-- > 0;) {
reversed_string.append(characters()[i]);
}