$reptok

From Scriptwiki
Revision as of 22:17, 15 November 2005 by Doomie (talk | contribs)

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

Replaces the Nth matching token in text with a new token.

$reptok(text,token,new,N,C)

Note that $reptokcs() is the case-sensitive version.

Example

var %myoldtext = This is my old text
var %mynewtext = $reptok(%myoldtext, old, new, 1, 32)
echo -a %mynewtext

This example echo's This is my new text, as it replaced old with new.

var %numbers = 4,5,6,6,8,9
var %numbers = $reptok(%numbers,6,7,2,44)
echo -a %numbers

This echo's 4,5,6,7,8,9, as it replaced the second 6 with 7.