I am writing a code to if characters from 1 string are present in another string. I used string.Contains but its not solving my case
string str = "abc";
string str2 = "ac";
if(str.Contains(str2))
{
Console.WriteLine("true");
}
I want result to be true. but its not returning true
I am writing a code to if characters from 1 string are present in another string.
I guess you want to check: " if All characters from 1 string are present in another string."
string str = "abc";
string str2 = "ac";
Console.WriteLine(str2.All(x => str.Contains(x)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.