Difference between revisions of "Delete"

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
(Forgot that I'd need to write() the buffer in order for it to do anything.)
imported>Heeheehee
m (Renamed start and end since it might confuse readers (they happen to be other ASH functions dealing with buffers))
Line 13: Line 13:
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
 
parameter1={{Param|buffer|original}}|
 
parameter1={{Param|buffer|original}}|
parameter2={{Param|int|start}}|
+
parameter2={{Param|int|strStart}}|
parameter3={{Param|int|end}}|
+
parameter3={{Param|int|strEnd}}|
 
p1desc={{Pspan|original}} is the buffer to modify|
 
p1desc={{Pspan|original}} is the buffer to modify|
p2desc={{Pspan|start}} marks where to start deleting|
+
p2desc={{Pspan|strStart}} marks where to start deleting|
p3desc={{Pspan|end}} marks where to end deleting|
+
p3desc={{Pspan|strEnd}} marks where to end deleting|
 
}}|
 
}}|
  
function_description=Returns the buffer {{pspan|original}} with the substring from {{pspan|start}} to {{pspan|end}} removed.|
+
function_description=Returns the buffer {{pspan|original}} with the substring from {{pspan|strStart}} to {{pspan|strEnd}} removed.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|

Revision as of 05:05, 20 April 2010

Function Syntax

buffer delete(buffer original ,int strStart ,int strEnd )

  • original is the buffer to modify
  • strStart marks where to start deleting
  • strEnd marks where to end deleting

Returns the buffer original with the substring from strStart to strEnd removed.

Code Sample

Removes the border that KoL uses to frame some tables.

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

string del = " style=\"padding: 5px; border: 1px solid blue;\"";
int st = results.index_of(del);
if ( st > -1 ) results.delete(st, st+length(del));
else print("string '"+del+ "' not found"); 
results.write();

See Also

insert()