Well, that was my first shot, but then I found this post: http://stackoverflow.com/questions/2992329/check-if-string-is-just-white-space that says this approach should be faster that trim / regexp.

But of course, trim is more readable. Should I change it?