From: Dave Burt Date: 2004-12-02T16:47:44+09:00 Subject: Re: Does Ruby have anything like isprint? "Martin Kahlert" wrote... > Hi! > > I want to print out the 'printable' characters from a binary > data stream. > Is there anything like C's isprint() function in Ruby? > > Thanks, > Martin. You can use the POSIX regular expression 'metacharacter' [:print:] to match a printing character. def isprint(c) /[[:print:]]/ === c.chr end Or you can .gsub(/[^[:print:]]/, '') on a string, etc.