Difference between revisions of "Talk:Replace string"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
(Created page with 'In reference to the RFI: {{CodeSample| description=For example, with this:| code= <syntaxhighlight> replace_string("abababa","aba","X"); </syntaxhighlight>| moreinfo= You get th…')
 
imported>Heeheehee
m
Line 14: Line 14:
  
 
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?
 
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.

Revision as of 03:20, 17 March 2010

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.