Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Workaround for String.Contains() in C# .NetCF 2.0?

There is a string method called Contains. It allows you to quickly search a string for another string. I need to use this in a .netcf 2.0 application but per MSDN it does not come available until the 3.5 framework.

Can anyone offer a work around (C#)?

TIA Noble

like image 403
Noble Bell Avatar asked Nov 21 '25 04:11

Noble Bell


2 Answers

You could try using String.IndexOf. If it returns -1, the string does not exist inside the other string.

like image 192
keyboardP Avatar answered Nov 23 '25 20:11

keyboardP


What about string.IndexOf and just check to see if it returns greater than -1?

like image 34
Matt Greer Avatar answered Nov 23 '25 18:11

Matt Greer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!