With a String s, to determine if it contains "a" or "b" or "c". Something that is better than checking each individually:
if (s.contains("a")||s.contains("b")||s.contains("c"))
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.
If you are looking for single characters, you can use
String.IndexOfAny().If you want arbitrary strings, then I’m not aware of a .NET method to achieve that “directly”, although a regular expression would work.