Insert

From Kolmafia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Function Syntax

buffer insert(buffer original ,int strStart ,string stuff )

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

Returns the buffer original with the string stuff inserted at strStart.

Code Sample

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

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

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

See Also

delete() | append() | set_length()