Difference between revisions of "$remtok"

From Scriptwiki
Jump to: navigation, search
m (Added example to remove a token from a varible)
Line 4: Line 4:
 
'''Note''' that if you do not specify N, it will remove the first instance of the token you have specifed.
 
'''Note''' that if you do not specify N, it will remove the first instance of the token you have specifed.
 
== Example ==
 
== Example ==
  [[echo]] -ag $remtok(This is a moo test, moo, 1, 32)
+
  [[echo]] -ag $remtok(This is a moo test,moo,1,32)
 
This echo's ''This is a test'', as ''moo'' is removed from the text.
 
This echo's ''This is a test'', as ''moo'' is removed from the text.
  
Line 12: Line 12:
 
  echo -ag $remtok(%mytext,%token,32)
 
  echo -ag $remtok(%mytext,%token,32)
 
This example will remove the first instance of the word ''word'' and so echos: ''This will remove a word''.
 
This example will remove the first instance of the word ''word'' and so echos: ''This will remove a word''.
   
+
 
 +
 
 +
  var %mytoks = House Tree Bear Ship
 +
var %mytoks = $remtok(%mytoks,Tree,32)
 +
echo -ag Ours tokens are now: %mytoks
 +
The above example shows how you can remove a token from a varible.
 
[[Category:Token Identifiers]]
 
[[Category:Token Identifiers]]

Revision as of 17:46, 9 May 2006

Removes the Nth matching token from text.

$remtok(text,token,N,C)

Note that if you do not specify N, it will remove the first instance of the token you have specifed.

Example

echo -ag $remtok(This is a moo test,moo,1,32)

This echo's This is a test, as moo is removed from the text.


var %mytext = This word will remove a word
var %token = word
echo -ag $remtok(%mytext,%token,32)

This example will remove the first instance of the word word and so echos: This will remove a word.


var %mytoks = House Tree Bear Ship
var %mytoks = $remtok(%mytoks,Tree,32)
echo -ag Ours tokens are now: %mytoks

The above example shows how you can remove a token from a varible.