Did C# provide any method to compare the string with a wildcard pattern like. Or I can say I want to find a "Like Operator" to do string comparison. Suppose I have a string .I also have a paragraph , I want to find the string on this parapgraph,But how.In SQL we can do it just using the LIKE operator.
Any Suggestion and reply is grateful.
The strcmp() function, is used to compare the strings (str1,str2). The strings str1 and str2 will be compared using this function. If the function returns a value 0, it signifies that the strings are equal otherwise, strings are not equal.
Use the asterisk ( * ) to match any sequence or string of characters. The ( * ) indicates any characters, including no characters.
The comparison operators also work on strings. To see if two strings are equal you simply write a boolean expression using the equality operator.
You can use the asterisk (*) anywhere in a character string.
Wildcards are a complicated beast (a form of regular expressions), but it sounds like you want the Contains
method. You can just do paragraph.Contains(sentence)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With