Either I'm just too stupid, or D is lacking something
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Tue Jul 25 14:36:32 PDT 2006
Chris Nicholson-Sauls wrote:
> The '$' is currently used as an alias to the '.length' property of
> arrays, available only as a right-hand-side to the range sub-op in the
> slice-op.
> array[0 .. $] == array[0 .. array.length]
Actually, it also works perfectly fine in the left sub-op in the slice-op:
import std.stdio;
void main()
{
char[] a = "Hello world!";
char[] b = a[$-6 .. $-1];
writefln(b);
}
prints "world" to stdout, no problem :).
More information about the Digitalmars-d
mailing list