Given a string like x@gmail.com, b@yahoo.com, c@ebay.com
How can I, using ruby, see if the string contains c@ebay.com ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
update
If you want to pass multiple emails to include you can use the following code if you are using ruby 1.9.2:
As for ruby version below that you could do something like this:
Since emails is a string it poses some problems. You can create an array or emails to check the string by with an each method but your code seems to be as good if not better.