[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: how to determine if a string is printable?

Guillaume Theoret

5/16/2007 12:49:00 AM

if(string =~ /.*[\a\b\e\f\n\r\t\v].*/)
puts "Invalid string"
else
puts string + " is ok"
end

On 5/15/07, Mike Steiner <mikejaysteiner@gmail.com> wrote:
> Is there an easy way to test if a string is printable (doesn't contain
> control characters)? Something easier than listing out all the letters,
> numbers, and punctuation and checking each character.
>
> Mike Steiner
>