Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

indexOf finds empty string

Tags:

c#

I got a positive result when ctrl.Text happened to be an empty string (value was 0)

Is that the correct behavior? Do I need to check for an empty string?

"Next|Prev|First|Last|Search".IndexOf(ctrl.Text) > -1
like image 230
Rod Avatar asked Dec 16 '25 23:12

Rod


1 Answers

Yes, in the msdn you will find.

if value is String.Empty, the return value is 0.

like image 194
dowhilefor Avatar answered Dec 19 '25 11:12

dowhilefor



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!