Is there a way to “append” UTF-8 data to a `String`?

title says it all. i’m looking for a way to call String.init(decoding:as:) “on-the-fly” in order to accumulate UTF-8 data into the existing String buffer, instead of having to create a new String and re-copy it into the accumulator String.

3 Likes

Unfortunately, currently there is not. It would be really, really great to add, though.

For me, this was one of the deciding factors that led to WebURL storing its data in a ManagedBuffer. It would have been great to have literally free URL -> String conversion, but it would mean only manipulating strings at the character or unicode scalar level, and that's just not sufficient.

3 Likes