Stride

RenatoL rexlen at gmail.com
Sun Feb 12 09:37:15 PST 2012


Loosing my time on skittles...

input "abcd"
desired output "arcd"
i want to use stride

snippet, where x and y are integer in real code:

    string s1 = "abcd";
    s1 = s1[stride(s1,x)..y] ~ 'r' ~ s1[2..$];

if x = 0 and y = 0 -> run time error. ok
if x = 0 and y = 1 -> "rcd" (??)
if x = 1 and y = 0 -> run time error. ok
if x = 1 and y = 1 -> "rcd"
if x = 0 and y = 2 -> "brcd" (WTF?)
if x = 1 and y = 2 -> "brcd" (...)

what the hell of parameters have i to put to achieve "arcd"?


More information about the Digitalmars-d-learn mailing list