Answers for "how to check string contains any value in c#"

Lua
3

if string contains number c#

"abc3def".Any(c => char.IsDigit(c));

// Or to make it shorter:
"abc3def".Any(char.IsDigit);
Posted by: Guest on August-23-2020
0

check if string is in string

string stringToCheck = "text1";
string[] stringArray = { "text1", "testtest", "test1test2", "test2text1" };
foreach (string x in stringArray)
{
    if (x == stringToCheck)
    {
        // Process...
    }
}
Posted by: Guest on January-01-1970

Code answers related to "how to check string contains any value in c#"

Browse Popular Code Answers by Language