Fix estimated length when removing characters

This commit is contained in:
Max Radermacher 2026-05-27 14:30:16 -05:00 committed by GitHub
parent 975834e1f6
commit c91c15ec7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,7 +62,7 @@ public extension String {
// Create the result string and set up a capacity close to the final string
var result = ""
result.reserveCapacity(self.count)
result.reserveCapacity(self.utf8.count)
// Iterate through the ranges, appending the string between the last
// match and the next, and then appending the replacement string