Talk:Replace string

From Kolmafia
Jump to navigation Jump to search

In reference to the RFI:

For example, with this:

replace_string("abababa","aba","X");

You get this:

Returned: XbX


I can't think of an example that would produce what's on my mind, and not even sure if it's possible, but if somehow there would be more replacements available if the first instance of a match was ignored, would this function prefer to do so, or does it indeed go left-to-right?

There are no such cases; going left-to-right (incidentally, also easier to code) is how all functions like this work.


It's not a matter of "easier to read" for the instances of '\"', but rather "what's present in the HTML". Since double-quotes are, and single-quotes aren't, we need to use '\"' in order to find this text. --Heeheehee 23:46, 12 April 2010 (UTC)