mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
AK: Ensure StringBuilder capacity in String::reverse
This commit is contained in:
parent
4a2a084789
commit
a768131720
1 changed files with 1 additions and 1 deletions
|
@ -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]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue