def printable(str) return "" unless str eval(str.strip.dump.gsub(/\\[0-9]{3}/,'')) end
You need to create an account or log in to post comments to this site.
11391 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
def printable(str) return "" unless str eval(str.strip.dump.gsub(/\\[0-9]{3}/,'')) end
You need to create an account or log in to post comments to this site.
Assuming that you want only printable ASCII characters, here is a better, more efficient, less convoluted way: