What is the simplest way of doing @nogc string concatenation?

Guillaume Piolat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 4 07:56:46 PDT 2016


On Friday, 4 November 2016 at 14:55:27 UTC, Guillaume Piolat 
wrote:
> On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby 
> wrote:
>> What is the simplest way of doing @nogc string concatenation?
>
> I use sprintf + zero-terminated strings (or a RAII struct to 
> convert slices to ZT strings).

Example with the the useful "%.s" format:
https://github.com/AuburnSounds/dplug/blob/1037d8a99a6ac730f4d6cc56806dddc83bce07ed/client/dplug/client/client.d#L442

That way you don't have to add the terminal '\0'


More information about the Digitalmars-d-learn mailing list