Insert

From Kolmafia
Revision as of 04:57, 20 April 2010 by imported>Heeheehee (Created page with '{{ #vardefine:name|insert}}{{ #vardefine:return_type|buffer}}{{ FunctionPage| name={{#var:name}}| function_category=String Handling Routines| function1={{Function| name={{#var:…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

buffer insert(buffer original ,int start ,int end )

  • original is the buffer to modify
  • start marks where to insert the string
  • stuff is the string to insert

Returns the buffer original with the string stuff inserted at start removed.

Code Sample

Inserts a "Refresh page" link to the Pyramid inside KoL's default border.

buffer results;
results.append(visit_url());

int end = results.index_of("height=137 border=0>");
if(end>0) {
   results.insert(end+20,"<br /><div align='center' class='tiny'><a href='pyramid.php'>Refresh page</a></div>");
}
results.write();

See Also

delete()