I made this small identifier so that you can retrieve the Nth character ($2) in a string of text ($1).
I didn't see an identifier in the help file for this, so I decided to make it, because it would make parsing through a single word/nick, character by character, easier.
Someone asked me to demonstrate it, so I made a quite pointless snippet that replaces the first vowel in a nickname with the l33t speak version of the vowel. Sadly, I couldn't find one for U that was on character, heh.
alias vowel {
unset %i %m %d
If (a !isin $1-) && (e !isin $1-) && (i !isin $1-) && (o !isin $1-) { return $1 }
While ($posi($1-,%i)) {
unset %m
If ($posi($1-,%i) isin aeio) { %m = $replace($posi($1-,%i),a,4,e,3,i,1,o,0) }
If (%m = $null) { %m = $posi($1-,%i) }
%d = $iif(%d,%d $+ %m,%m)
If (%m isin 4310) { goto end }
inc %i
}
:end
return %d $+ $right($1-,$calc($len($1-) - $len(%d)))
}
That is how a $posi could be used.
alias posi {
If (!$2) || ($2 !isnum) { var %r $null }
var %r $right($left($1,$2),1)
return %r
}