Thursday, 22 August 2013

Java Split issue

Java Split issue

User will be entering the email ids in the text box with semicolon as
separator. Before storing into db, i want to validate whether entered
email id are valid. So i started using split. But the problem is, when
user enter the value like 'xxxx@gmail.com;;;', in this case i want to
validate to remove the unwanted characters.
I thought split will return the length will be 4 and then i can check for
empty or null. But split returning length as only one. So along with extra
characters it stores in the DB. Any help to resolve this ?

No comments:

Post a Comment