Stride
Ali Çehreli
acehreli at yahoo.com
Sun Feb 12 10:33:46 PST 2012
On 02/12/2012 10:25 AM, RenatoL wrote:
> This is the code i compiled v. 2057 and parameters 0 1
> import std.stdio;
> import std.utf;
> void main()
> {
> string s1 = "abcd";
> s1 = s1[stride(s1,0)..1] ~ 'r' ~ s1[2..$];
> writeln(s1);
> }
Argh! std.algorithm.stride() and std.utf.stride() are different. :) What
a confusion! :(
I think the following is correct for the first part, but the 2 in the
last part will also be wrong unless it is also calculated:
s1 = s1[0..stride(s1,0)] ~ 'r' ~ s1[2..$];
Ali
More information about the Digitalmars-d-learn
mailing list