$puttok

From Scriptwiki
Revision as of 18:41, 17 October 2005 by Doomie (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overwrites the Nth token in text with a new token.

$puttok(text,token,N,C)

Note that you can specify a negative N.

Example

echo -ag $puttok(This is a moo, test, 4, 32)

This example replaces moo with test and therefor echo's This is a test.

var %text = This is a moo
var %replacefrom = moo
var %replaceto = test
%text = $puttok(%text, %replaceto, $findtok(%text, %replacefrom, 1, 32), 32)
echo -ag %text

This example echo's This is a test too, as $findtok() returns the position of moo in the string and $puttok replaces this token with test.