Crazy stuff
Simen Kjaeraas
simen.kjaras at gmail.com
Sun Apr 27 14:22:11 PDT 2008
Tower Ty <tytower at hotmail.com.au> wrote:
> Thanks -now to stick the hair back. Would never have thought of
> approaching it with append . Logically I just want to put it in a firm
> place with a defined index address.
>
> Does not seem to be covered in the Tango book either.
This works just as well:
string[] a = ["Hello", "World"];
string[][] b;
b.length = 2;
b[0] = a.dup;
a[0] = "HAI";
a[1] = "WURLD!1";
b[1] = a.dup;
writefln(b); // prints [[Hello,World],[HAI,WORLD!!!1]]
Now, without the b.length = 2;, you'll get an array bounds error, of
course.
> So can you explain how you are using " string".
> What are you importing to be able to use string?
I'm just importing std.stdio. I think string is a compiler-defined alias,
but I
can't say whence I got the idea.
-- Simen
More information about the Digitalmars-d-learn
mailing list