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

Hi spammers! No need to waste your time here; comments are heavily moderated, so if you like, you can save us both a little time and just move on to the next site. :-)

For everyone else: Thanks for visiting! Your comments are more than welcome!