Replace string: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
Created page with '{{ #vardefine:name|replace_string}}{{ #vardefine:return_type|buffer}}{{ FunctionPage| name={{#var:name}}| function_category=String Handling Routines| function1={{Function| name…'
 
imported>StDoodle
mNo edit summary
Line 30: Line 30:
}}|
}}|


function_description=Replaces|
function_description=Searches through the supplied {{pspan|original}} text, replacing every instance of {{pspan|find}} with {{pspan|replace}}, and returns the result.|


needscode=yes|
needscode=yes|


special=First all what?|
special=Matches are made left-to-right, and once a portion of the supplied {{pspan|original}} is noted as a match, searching continues from the next character after said match.|
}}
}}

Revision as of 15:03, 12 March 2010

needs(code_samples);

Function Syntax

buffer replace_string(buffer original ,string find ,string replace )

buffer replace_string(string original ,string find ,string replace )

  • original is the starting string or buffer
  • find is the text to find in original
  • replace is the text to substitute for find

Searches through the supplied original text, replacing every instance of find with replace, and returns the result.

Special

Matches are made left-to-right, and once a portion of the supplied original is noted as a match, searching continues from the next character after said match.