Better slicing

NN NN_member at pathlink.com
Wed Mar 8 09:59:12 PST 2006


What about more powerful slicing, like e.g. in Python ?

char[] x;

char[] y = x[0 : x.size : 1];
char[] y = x[x.size : 1]; // Same

char[] z = x[x.size : 0 : -1]; // Reverse
char[] z = x[x.size :: -1]; // Same

// Maybe with D syntax
char[] x;

char[] y = x[0 .. x.size .. 1];
char[] y = x[x.size .. 1]; // Same

char[] z = x[x.size .. 0 .. -1]; // Reverse
char[] z = x[x.size .. .. -1]; // Same





More information about the Digitalmars-d mailing list