Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: can't quite get it right...

From: hallvard:ystad:helpinhand at: 29-Dec-2002 22:18

Hi Anton, Your uppercase? function is nice. I looked at it a bit, because I need a function that could do something like:
>> uppercase? #"n"
== none
>> uppercase? #"Y"
== true
>> uppercase? "No"
== false
>> uppercase? "YES"
== true 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]] ] true ] As you can see, it's an extended version of your function. And so here's my question: could this be trimmed further? Thanks, ~H Dixit Anton (12.55 07.09.2001):