开发者

string .IndexOf with startIndex

开发者 https://www.devze.com 2023-01-15 02:16 出处:网络
whe开发者_Go百科n you use a startIndex in a IndoexOf method if not match is found does it return -1 or your startIndex? I ran this in my code and want to make sure what I got is right.It returns -1 if

whe开发者_Go百科n you use a startIndex in a IndoexOf method if not match is found does it return -1 or your startIndex? I ran this in my code and want to make sure what I got is right.


It returns -1 if no match is found. It clearly says so in the docs.


It will return -1 just like in the other overload of IndexOf. A quick way to find answers to things like this is a great little app called LinqPad, which allows you to write and run little snippets of code on the fly.

0

精彩评论

暂无评论...
验证码 换一张
取 消