We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65c4648 commit 2f24a0aCopy full SHA for 2f24a0a
std/utf.d
@@ -2470,8 +2470,15 @@ char[] toUTF8(return out char[4] buf, dchar c) nothrow @nogc @safe pure
2470
*/
2471
string toUTF8(S)(S s) if (isSomeString!S)
2472
{
2473
- import std.array : array;
2474
- return s.byChar.array;
+ import std.array : appender;
+
2475
+ auto app = appender!string();
2476
+ app.reserve(s.length);
2477
2478
+ foreach (c; s.byChar)
2479
+ app.put(c);
2480
2481
+ return app.data;
2482
}
2483
2484
///
0 commit comments