Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to search a specific character in a String  RSS feed

 
Anagha Medicharla
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Using swing i am creating a text field which will take email address from user.I have one question ,how to check that user has entered '@'(and also '.').Does anybody know this?
I need urgent help.

Thanks
Anagha
------------------
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anagha,
u can use
int i = txtfld.getText().indexOf('@');
if i==-1 then it means '@' is not there in the textfield.

regards
deeksha
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!