Home All Groups Group Topic Archive Search About

String.IndexOf(string, int, int) bug? help!

Author
21 Jun 2006 3:19 PM
Qun
Hi all.
this is in .net 2.0, c#

//code
string d = "dddd????";
int i = d.IndexOf('?', 0, 3); // return -1, why???
// end

Thanks

Author
21 Jun 2006 3:25 PM
Markus Kling
Your code only searches for a '?' within the substring (0, 3) and there is
no '?'. The answer is correctly -1 :)

http://msdn2.microsoft.com/de-de/library/ms131434.aspx

Markus


Show quote
"Qun" <tshwa***@gmail.com> schrieb im Newsbeitrag
news:1150903156.500285.117110@y41g2000cwy.googlegroups.com...
> Hi all.
> this is in .net 2.0, c#
>
> //code
> string d = "dddd????";
> int i = d.IndexOf('?', 0, 3); // return -1, why???
> // end
>
> Thanks
>

AddThis Social Bookmark Button