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)
Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here