From Scriptwiki
Jump to: navigation, search

Removes the Nth matching token from text.


If N is 0, removes all matching tokens.

If N is not specified, removes the first matching token.


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

This echoes 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 echo: 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. Echoes Ours tokens are now: House Bear Ship

var %mytext = lol some people lol too often in lol sentences, lol
echo -ag $remtok(%mytext,lol,0,32)

This example shows how you can remove all matching tokens in a string by using N = 0. Echoes some people too often in sentences,