I know you said you'd like to stay away from regex solutions, but in this case, they are the most elegant. Here are two different regex solutions that are relatively easy to understand.

First is this identifier:
alias firstletter { noop $regex($1,/([a-z])/i) | return $regml(1) }

This code simply returns the first letter from $1, whether it is upper or lowercase. You can do whatever you want with it. In this case you could do something like this:

... if ($firstletter($nick) isupper) echo -a $v1 is UPPER

An explanation of the regex:

/ = beginning of regex
( = beginning of capture group 1
[a-z] = any character from a-z (not case sensitive, see i below)
) = end of capture group
/ = end of regex
i = regex is case insensitive


The second identifier:
alias isfirstupper return $regex($1,/^[^a-z]*[A-Z]/)

This code returns 1 if the first letter is uppercase and 0 if the first letter is not uppercase. This code would be used like this:

... if ($isfirstupper($nick)) echo -a First character is UPPER

This regex is slightly more complex and more difficult to understand.

/ = beginning of regex
^ = beginning of string
[^a-z]* = 0 or more of any character that isn't a-z (IS case sensitive)
[A-Z] = any character from A-Z (IS case sensitive)
/ = end of regex

Basically, from the beginning of the string, if there are 0 or more characters except a-z (CS), followed by A-Z. The rest of the string is abandoned once the first A-Z is found.


You want to stay away from regex, but I think the first regex example is simple enough that you may want to bend that rule a bit. ;P