From: Ammar Ali Date: 2010-10-28T16:50:37+09:00 Subject: ctype functionality without a gem? Hello, Is there a built-in method for identifying character types a la ctype() in C? I would like to avoid requiring a gem dependency. I'm considering the following approach, if nothing exists, but it seems like overkill to me. def ctype(c) case c when /[[:alnum:]]/; :alnum when /[[:alpha:]]/; :alpha # etc... end end def alnum?(c); ctype(c) == :alnum end def alpha?(c); ctype(c) == :alpha end # etc... Also, it requires some 1.8 vs 1.9 special cases for 'ascii' and 'word', if not more. Regards, Ammar