string to char array?

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 2 08:38:23 PDT 2015


On Tuesday, 2 June 2015 at 15:32:12 UTC, Kyoji Klyden wrote:
> On Tuesday, 2 June 2015 at 15:26:50 UTC, Dennis Ritchie wrote:
>> On Tuesday, 2 June 2015 at 15:07:58 UTC, Kyoji Klyden wrote:
>>> quick question: What is the most efficient way to covert a 
>>> string to a char array?
>>
>> string s = "str";
>> char[] strArr = s.dup;
>
> Thanks! :)

Note that this will allocate a new garbage collected array.


More information about the Digitalmars-d-learn mailing list