; $switchtok - Sight
; ;; What this is ;;
; $switchtok switches the positions of two different tokens in a string of text
; ;; Syntax ;;
; $switchtok(string,,,C)
; ;; Examples ;;
; $switchtok(Testing this bodacious alias is sweet,3,6,32) switches boadcious and sweet returning: Testing this sweet alias is bodacious :)
; $switchtok - Sight
; ;; What this is ;;
; $switchtok switches the positions of two different tokens in a string of text
; ;; Syntax ;;
; $switchtok(string,<N>,<N2>,C)
; ;; Examples ;;
; $switchtok(Testing this bodacious alias is sweet,3,6,32) switches boadcious and sweet returning: Testing this sweet alias is bodacious :)
alias switchtok {
if ($$1 && $2-4) {
var %n = $gettok($$1,$2,$4)
return $iif(!%n || !$gettok($$1,$3,$4) || $3 = 0 || $2 = 0,$false,$instok($deltok($instok($deltok($$1,$2,$4),$gettok($$1,$3,$4),$2,$4),$3,$4),%n,$3,$4))
}
}
this is nice... however theres a problem especially when the param are not specified(null) like this example:
--> $switchtok(Testing this bodacious alias is sweet,3,,32)
or when the N or N2 specified as 0
--> $switchtok(Testing this bodacious alias is sweet,3,0,32)
just wanna shared with you :)
http://www.hawkee.com/snippet/1313/