Chea Indian Chea Indian - 9 months ago 35
Java Question

How do I check whether input string contains any spaces?

I have a input dialog that asks for XML element name, and I want to check it to see if it has any spaces.

can I do something like name.matches()?


Why use a regex?

name.contains(" ")

That should work just as well, and be faster.