Array slicing
Heinz
malagana15 at yahoo.es
Thu Dec 14 10:05:28 PST 2006
Hi, i'm trying to slice an array of chars and print it to the screen but it
doesn't seems to work, here's the code:
/////////////////////////////////////
import std.string;
alias char[] string;
int main(char[][] args)
{
printf("hello world\n");
string hw = "Hello_World";
printf(cast(char*)hw[0 .. 5]);
return 0;
}
/////////////////////////////////////
What could be wrong? it just prints to the output "Hello_World".
Heinz
More information about the Digitalmars-d-learn
mailing list