HighTechTalks DotNet Forums  

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

Dotnet Framework microsoft.public.dotnet.framework


Discuss String.IndexOf(string, int, int) bug? help! in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Qun
 
Posts: n/a

Default String.IndexOf(string, int, int) bug? help! - 06-21-2006 , 11:19 AM






Hi all.
this is in .net 2.0, c#

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

Thanks


Reply With Quote
  #2  
Old   
Markus Kling
 
Posts: n/a

Default Re: String.IndexOf(string, int, int) bug? help! - 06-21-2006 , 11:25 AM






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


"Qun" <tshwangq (AT) gmail (DOT) com> schrieb im Newsbeitrag
news:1150903156.500285.117110 (AT) y41g2000cwy (DOT) googlegroups.com...
Quote:
Hi all.
this is in .net 2.0, c#

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

Thanks




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.