$[reptok]

By Sight on Nov 01, 2007

; $[reptok] - Sight
; ;; What this is ;;
; $[reptok] is basically a position based token replacer
; ;; Syntax ;;
; $[reptok](,,,C) or $[reptok](,,,C).a
; ;; Examples ;;
; $[reptok](1 2 3 4,3,5,32) returns 1 2 5 4
; $[reptok](1 2 1 3 4,1,4,32).a returns 4 2 4 3 4

; $[reptok] - Sight
; ;; What this is ;;
; $[reptok] is basically a position based token replacer
; ;; Syntax ;;
; $[reptok](<string>,<N>,<New token>,C) or $[reptok](<string>,<Delimeter>,<New token>,C).a
; ;; Examples ;;
; $[reptok](1 2 3 4,3,5,32) returns 1 2 5 4
; $[reptok](1 2 1 3 4,1,4,32).a returns 4 2 4 3 4

alias [reptok] { 
  if (!$prop) return $iif(!$$1 || !$2-4 || $gettok($$1,$2,$4) = $3,$false,$instok($deltok($$1,$2,$4),$3,$2,$4))) 
  if ($prop = a) { 
    if (!$$1 || !$2-4) { return $false } 
    else { 
      var %c = $$1
      while ($findtok(%c,$2,$4)) { var %c = $reptok(%c,$gettok($$1,$ifmatch,$4),$3,$4) }
      return %c
    }
  } 
  else return $false
}

Comments

Sign in to comment.
Sight   -  Nov 01, 2007

Now has the option to replace all tokens in a string.

 Respond  
Sight   -  Nov 01, 2007

Ah, sometimes I forget those things. ;s But the cs serves no use, I just assumed at least someone would find a practical use for it. I think it is useless, and therefore am going to remove it right now. Thanks for your feedback xDaeMoN.

 Respond  
xDaeMoN   -  Nov 01, 2007

$puttok does the same. ;) Also, what\'s with the case sensitive version? Can you give an example on using this property?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.