www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.array replaceFirst

reply Steve Teale <steve.teale britseyeview.com> writes:
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)
Aug 22 2011
parent David Nadlinger <see klickverbot.at> writes:
On 8/22/11 9:35 AM, Steve Teale wrote:
 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)

This has already been fixed in Git master: http://d.puremagic.com/issues/show_bug.cgi?id=6428 David
Aug 22 2011