Returns a range of characters.
; ------------------------------------------------
; $range()
; Returns a range of characters from N-N:
; $range(<N>,<N>,[C])[.n]
; [C] and [.n] are optional. This pair adds a separator to each listed character in the range. If you don't specify one of the other, it just ignores them and returns the default list.
; ----------------------
; /range
; Same as the above in alias format; excluding the [C] and [.n] syntax
; /range <N> <N>
; Echoes the list
; ----------------------
; Here are some examples:
; /range 44 58 would return: [timestamp] * Range of characters 44-58: , - . / 0 1 2 3 4 5 6 7 8 9 :
; //echo -a $range(44,58) would return: , - . / 0 1 2 3 4 5 6 7 8 9 :
; //echo -a $range(44,58,42).n would return: ,*-*.*/*0*1*2*3*4*5*6*7*8*9*:
; ----------------------
; On another note:
; You can specify a character as N. For example:
; $range(*,58) would still return the range of characters normally.
; $range(*,:) would also return the same thing.
; ------------------------------------------------
alias range {
if ($1) && ($2) {
var %m = $iif($1 isnum,$1,$asc($v1)), %t = $iif($2 isnum,$2,$asc($2)), %u, %i = %m
if (%m isnum 1-255) && (%t isnum 1-255) && (%m < %t) {
while (%m <= %t) {
%u = $addtok(%u,$chr(%m),32)
inc %m
}
$iif($isid,return,echo -act info * Range of characters $+(%i,-,%t,:)) $iif($prop && $3 && $3 isnum 1-255,$replace(%u,$chr(32),$chr($3)),%u)
}
else return
}
else {
$iif($isid,return,echo -act info * /range:) $iif($isid,$false,insufficient paramaters)
}
}