Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #strreplace
- # 1 - where
- # 2 - what
- # 3 - with
- :global strreplace do={
- :local l1 [:len $1];
- :local l2 [:len $2];
- :local l3 [:len $3];
- :local lr 0;
- :local i 0;
- :local k -1;
- :local r $1;
- :do {
- :set lr [:len $r];
- :set i [:find $r $2 $k];
- :if ($i != nil) do={
- :set r ([:pick $r -1 $i] . $3 . [:pick $r ($i + $l2) $lr]) ;
- :set k ($i + $l3 - 1);
- }
- } while=($i < $l1)
- :return $r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement