string initialization question.

Steven Schveighoffer schveiguy at yahoo.com
Fri Jul 30 09:17:24 PDT 2010


On Fri, 30 Jul 2010 11:46:32 -0400, Justin Spahr-Summers  
<Justin.SpahrSummers at gmail.com> wrote:

> On Fri, 30 Jul 2010 11:35:15 -0400, Steven Schveighoffer
> <schveiguy at yahoo.com> wrote:
>>
>> If you want to allocate a new array on the heap with '-' in it, I think
>> there is a way, but I'm not sure how to do it.  I'm pretty sure there's  
>> a
>> runtime function to do it.
>>
> Something like this will work on the heap:
>
>     char[] divider = new char[5];
>     divider[] = '-';

That assigns 0xff to all divider chars, and then assigns '-'.  I think  
there's a way to do it without the initial assignment.

-Steve


More information about the Digitalmars-d-learn mailing list