Has anyone dealt with using std::string functions for MBCS? For example in C I could do this:
p = _mbsrchr(path, '\\');
but in C++ I'm doing this:
found = path.find_last_of('\\');
If the trail byte is a slash then would find_last_of stop at the trail byte? Also same question for std::wstring.
If I need to replace all of one character with another, say all forward slashes with backslashes what would be the right way to do that? Would I have to check each character for a lead surrogate byte and then skip the trail? Right now I'm doing this for each wchar:
if( *i == L'/' )
*i = L'\\';
Thanks
Edit: As David correctly points out there is more to deal with when working with multibyte codepages. Microsoft says use _mbclen for working with byte indices and MBCS. It does not appear I can use find_last_of reliably when working with the ANSI codepages.