diff --git a/Modules/FoundationExtras/Sources/FoundationExtras/String+RSCore.swift b/Modules/FoundationExtras/Sources/FoundationExtras/String+RSCore.swift index 3d0c141d3..ff89475ca 100644 --- a/Modules/FoundationExtras/Sources/FoundationExtras/String+RSCore.swift +++ b/Modules/FoundationExtras/Sources/FoundationExtras/String+RSCore.swift @@ -223,7 +223,12 @@ public extension String { preflight = preflight.removingTagAndContents("style") var s = String() - s.reserveCapacity(preflight.count) + if let maxCharacters { + s.reserveCapacity(maxCharacters) + } + else { + s.reserveCapacity(preflight.count) + } var lastCharacterWasSpace = false var charactersAdded = 0 var level = 0