Talk:Replace string: Difference between revisions

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
Regarding the recent rollback.
 
(One intermediate revision by the same user not shown)
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.
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. --[[User:Heeheehee|Heeheehee]] 23:46, 12 April 2010 (UTC)

Latest revision as of 23:46, 12 April 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.


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)