0 LIKES
Snippet
$replaceTok(string,substr,n,token) by Imk0tter
In Category General IRC Posted by Snippets On 12/04/23
Here is an alias that allows you to replace the n'th occurence of the specified substring in the specified string with a token.
Example: $replaceTok(this @ is @ a @ test, @, -1, --) = this @ is @ a -- test
Example: $replaceTok(this @ is @ a @ test, @, -1, --) = this @ is @ a -- test
alias replacetok { var %pos $pos($1,$2,$iif($3 > 0,$3,$calc($pos($1,$2,0) + $3 + 1))) return $+($left($1,$calc(%pos - 1)),$$4,$right($1,- $+ $calc(%pos + $len($2) - 1))) }
Comments 0
You must be logged in to comment.