[REBOL] Re: can't quite get it right...
From: hallvard:ystad:helpinhand at: 29-Dec-2002 22:18
Your uppercase? function is nice. I looked at it a bit, because I need a function that
could do something like:
>> uppercase? #"n"
>> uppercase? #"Y"
>> uppercase? "No"
>> uppercase? "YES"
So it would have to work with both char! and string!. In other programming languages,
I would have made two methods, and have the string function repeatedly use the char function.
In rebol, here's what I came up with:
uppercase?: func [ ch [char! string!] ] [
either char? ch [
return all [(ch >= #"A") (ch <= #"Z")]
foreach ar ch [if not all [(ar >= #"A") (ar <= #"Z")] [return false]]
As you can see, it's an extended version of your function. And so here's my question:
could this be trimmed further?
Dixit Anton (12.55 07.09.2001):