simplest way to check for just spaces in ruby

Posted by user301752 on Stack Overflow See other posts from Stack Overflow or by user301752
Published on 2010-03-25T18:42:20Z Indexed on 2010/03/25 18:43 UTC
Read the original article Hit count: 220

Filed under:
|
|
|

So I know in ruby that x.nil? will test if x is null.

What is the simplest way to test if x equals ' ', or ' ', or ' ', etc?

Basically, I'm wondering what the best way to test if a variable is all whitespace?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about spaces