Skip to content

Using C# to check if string contains a string in string array

Pieced this together from stackoverflow… http://stackoverflow.com/questions/2912476/using-c-sharp-to-check-if-string-contains-a-string-in-string-array/2912541#2912541

This checks if stringToCheck contains any one of substrings from stringArray.

If you want to ensure that it contains all the substrings, change Any to All:

 

Hits: 5112

Published inC#Coding

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.