Thursday, April 20, 2006

Error in MSDN docs for CString::Find()

While looking at the MSDN documentation page on the CString::Find() method (C++ MFC), I noticed some information that appears to be incorrect.

The signature of the method is:

int Find( TCHAR ch, int nStart ) const;
The comment on the nStart parameter is:
The index of the character in the string to begin the search with, or 0 to start from the beginning. The character at nStart is excluded from the search if nStart is not equal to 0.

(Emphasis added by me.) If the bolded part of the statement is true, is it just me, or would it be impossible to use the Find method to search a string beginning with the character at index 1? :-)

I tested the behavior of the method in a simple C++ console app using Visual Studio 2005. The character at nStart is indeed always included in the search, even if nStart is nonzero.

I reported this issue to Microsoft via their web feedback form, and got a reply that the issue has been forwarded "to the appropriate Microsoft group for review." We'll see if any changes are forthcoming!

No comments:

Post a Comment

Non-spammers: Thanks for visiting! Please go ahead and leave a comment; I read them all!

Attention SPAMMERS: I review all comments before they get posted, and I REPORT 100% of spam comments to Google as spam! Why not avoid getting your account banned as quickly -- and save us both a little time -- by skipping this comment form and moving on to the next one on your list? Thanks, and I hope you have a great day!