简体   繁体   中英

c# wildcard string comparison

I probably got an easy question for you but I haven't got the answer yet.

what I want is:

compare string1 with string2 , which I built via a code before (not essential for the question), and if the string2 is not essential, I use a wildcard to fit every string1 in string2 .

what I tried is:

string1= "whatever the case may be"
string2= "*"
LikeOperator.LikeString(string1, string2, Microsoft.VisualBasic.CompareMethod.Binary)

My wildcard is not working properly. it doesn't give a "true" back. What am I doing wrong there?

And the answer is:

You can't use wildcards on NULL-values. Workaround is, to write "" into the string if it is NULL.

Now it works the way I posted it right on top.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM