Syntax: $char(text,N)
Syntax: /char text N
simply returns Nth character in text, counting from the left. There might be a builtin identifier for this but I looked and looked and couldn't find one so I made my own. It's got a bit of poor coding in that the local variable %f is pretty unclean, but its functional.
alias char {
if ( !$1 ) || ( !$2 ) || ( $2 !isnum 1- ) {
$iif($isid == $false,echo $colour(info) -a * CHAR not enough parameters,return $null)
}
if ( $2 > $len($1) ) {
$iif($isid == $false,echo $colour(info) -a * CHAR $2 $+ th character does not exist,return $null)
halt
}
var %x = 1,%f = 0
while ( %x <= $2 ) {
%f = $addtok(%f,$remove($left($1,%x),$left($1,$calc(%x - 1))),44)
inc %x 1
}
$iif($isid == $false,echo $colour(info) -a * CHAR: $gettok(%f,$numtok(%f,44),44),return $gettok(%f,$numtok(%f,44),44))
}