$asize(text).[s]
returns the size of the alias , if the property s is used then it will also count spaces and linebreak.
Note: make sure the alias is not on a ini file.
*/
alias asize {
var %f = $isalias($1).fname ,%d $isalias($1).alias
if ($1 != $gettok(%d,1,32)) %d = $1 %d
else %d = alias %d
if (!$read(%f,nr,%d)) %d = $read(%f,nw,%d)
var %x $readn, %a $regex($read(%f,n,%x),/\x7B/g) , %b 0 , %c
if (!%a) inc %c $iif($prop,$len(%d),$regex(%d,/\S/g))
else {
dec %a
while (%a > %b || !%a && %x < $lines(%f)) {
var %t $read(%f,n,%x)
inc %a $regex(%t,/\x7B/g)
inc %b $regex(%t,/\x7D/g)
if (%t) inc %c $iif($prop,$len(%t),$regex(%t,/\S/g))
inc %x
}
}
return %c
}
alias asize {
var %f = $isalias($1).fname ,%d $isalias($1).alias
if ($1 != $gettok(%d,1,32)) %d = $1 %d
else %d = alias %d
if (!$read(%f,nr,%d)) %d = $read(%f,nw,%d)
var %x $readn, %a $regex($read(%f,n,%x),/\x7B/g) , %b 0 , %c
if (!%a) inc %c $iif($prop,$len(%d),$regex(%d,/\S/g))
else {
dec %a
while (%a > %b || !%a && %x < $lines(%f)) {
var %t $read(%f,n,%x)
inc %a $regex(%t,/\x7B/g)
inc %b $regex(%t,/\x7D/g)
if (%t) inc %c $iif($prop,$len(%t),$regex(%t,/\S/g))
inc %x
}
}
return %c
}
Ingen kommentarer:
Send en kommentar