List Creator by Roy911
This is a rather simple script that creates a list from a set of tokens.
The token-separator is defined by $1.
Paste in aliases
Note: The identifiers $cap and $wordget are nessesary for use.
Usage:
//echo $list(32,a as asd asdf asdfg asdfgh asdfghj)
Would result in: A, as, asd, asdf, asdfg, asdfgh, and asdfghj.
/*
List Creator by Roy911
irc.abxy.org:#Roy911
Usage:
This is a rather simple script that creates a list from a set of tokens.
The token-separator is defined by $1.
//echo $list(32,a as asd asdf asdfg asdfgh asdfghj)
Would result in: A, as, asd, asdf, asdfg, asdfgh, and asdfghj.
*/
alias list {
;This alias creates a list
var %token = $1
var %len = $numtok($2-,%token)
var %pos = 1
var %list = $null
if (%len == 1) {
var %list = $2
var %list = %list $+ .
goto return
}
if (%len == 2) {
var %list = $wordget(1,%token,$2-) and $wordget(2,%token,$2-) $+ .
goto return
}
while (%len != 0) {
if (%len == 1) {
var %list = %list $+ , and $+ $chr(32) $+ $wordget(%pos,%token,$2-) $+ .
}
else {
var %list = %list $+ $chr(44) $+ $chr(32) $+ $wordget(%pos,%token,$2-) $+ ,
}
inc %pos 1
dec %len 1
}
var %list = $mid(%list,3,$len(%list))
;echo $active %list
var %list = $cap(%list)
:return
;echo $active %list
return %list
}
alias WordGet {
var %word = $1
var %sep = $2
var %token = $3-
var %return = $gettok(%token,%word,%sep)
return %return
}
alias cap {
return $upper($mid($1-,1,1)) $+ $lower($mid($1-,2,$len($1-)))
}