std.array replaceFirst

Steve Teale steve.teale at britseyeview.com
Mon Aug 22 00:35:30 PDT 2011


import std.stdio;
import std.array;

void main()
{
   string s = "the slow - very slow - brown fox";
   string rf = replaceFirst(s, "slow", "quick");
   writeln(rf);     // prints "the quick"
   string r = replace(s, "slow", "quick");
   writeln(r);      // prints "the quick - very quick - brown fox"
}

Is this as intended? (version 2.054)


More information about the Digitalmars-d mailing list