$len
From Scriptwiki
Returns the length of text.
$len(text)
$len(length) returns 6.
$len() is simple, but powerful tool processing strings.
Examples
This example turn uppercase letters to lowercase and upwards.
$len is used to get value of string (value given to alias) and loop through it every character.
alias changecase { var %i = 1, %str, %c while (%i <= $len($$1-)) { %c = $mid($1-, %i, 1) if ($isupper(%c)) { %str = %str $+ $lower(%c) } else { %str = %str $+ $upper(%c) } inc %i } return %str } echo -a $changecase(Hello) ; returns hELLO