Insert: Difference between revisions
Jump to navigation
Jump to search
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:…' |
imported>Heeheehee m Renamed end since it might confuse readers (same name as an ASH function that also deals with buffers). Also changed parameters (silly me!) |
||
Line 14: | Line 14: | ||
parameter1={{Param|buffer|original}}| | parameter1={{Param|buffer|original}}| | ||
parameter2={{Param|int|start}}| | parameter2={{Param|int|start}}| | ||
parameter3={{Param| | parameter3={{Param|string|stuff}}| | ||
p1desc={{Pspan|original}} is the buffer to modify| | p1desc={{Pspan|original}} is the buffer to modify| | ||
p2desc={{Pspan|start}} marks where to insert the string| | p2desc={{Pspan|start}} marks where to insert the string| | ||
Line 30: | Line 30: | ||
results.append(visit_url()); | results.append(visit_url()); | ||
int | int strEnd = results.index_of("height=137 border=0>"); | ||
if( | if(strEnd > 0) { | ||
results.insert( | results.insert(strEnd + 20,"<br /><div align='center' class='tiny'><a href='pyramid.php'>Refresh page</a></div>"); | ||
} | } | ||
results.write(); | results.write(); |
Revision as of 05:03, 20 April 2010
Function Syntax
buffer insert(buffer original ,int start ,string stuff )
- 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 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