Mohan Mehra wrote:i just want one short name for this conditions to display to the user when the user enters wrong characters in the name field
Personally, I like Rohit's answer; however, you could eliminate one of your conditions by simply running String.trim() on the input, especially if you tell them in advance that this is what will happen, eg:
Please enter name (leading/trailing spaces will be ignored)
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here