Difference between pages "Talk:Group string" and "Insert"
(Difference between pages)
Jump to navigation
Jump to search
imported>Heeheehee m |
imported>Bale m |
||
Line 1: | Line 1: | ||
− | + | {{ | |
+ | #vardefine:name|insert}}{{ | ||
+ | #vardefine:return_type|buffer}}{{ | ||
− | + | FunctionPage| | |
+ | name={{#var:name}}| | ||
− | + | function1={{Function| | |
+ | name={{#var:name}}| | ||
+ | aggregate={{#var:aggregate}}| | ||
+ | return_type={{#var:return_type}}| | ||
+ | return_also={{#var:return_also}}| | ||
+ | parameter1={{Param|buffer|original}}| | ||
+ | parameter2={{Param|int|strStart}}| | ||
+ | parameter3={{Param|string|stuff}}| | ||
+ | p1desc={{Pspan|original}} is the buffer to modify| | ||
+ | p2desc={{Pspan|strStart}} marks where to insert the string| | ||
+ | p3desc={{Pspan|stuff}} is the string to insert| | ||
+ | }}| | ||
− | + | function_description=Returns the buffer {{pspan|original}} with the string {{pspan|stuff}} inserted at {{pspan|strStart}}.| | |
− | + | code1={{CodeSample| | |
+ | title=Code Sample| | ||
+ | description=Inserts a "Refresh page" link to the Pyramid inside KoL's default border.| | ||
+ | code= | ||
+ | <syntaxhighlight> | ||
+ | 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(); | ||
+ | </syntaxhighlight> | ||
+ | }}| | ||
+ | see_also={{SeeAlso|delete}}| | ||
+ | }} | ||
− | + | [[Category:String Handling Routines]] | |
− | |||
− | |||
− | : |
Revision as of 05:14, 22 May 2010
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();