I have the following string:
index 0 1 2 3 4 5 6 7
std::string myString with the content of "\xff\xff\xff\x00\xff\x0d\x0a\xf5"
When I'm refering to myString[3], I get the expected '\x00' value.
But when I'm referring to myString[5], I get two values "\x0d\x0a" instead of just '\x0d'.
Even more interesting is the myString[6] value, which is the '\xf5'. This time it's like the \x0d didn't exist and the correct position was referenced.
My question would be: what is so special about the \x0d character in a std:string object? How come it is skipped when indexing? It's like counting this way:
index 0 1 2 3 4 5 5 6
std::string myString = "\xff\xff\xff\x00\xff\x0d\x0a\xf5"
As a comment, the '\x0d' character is the 13th ASCII character "carriage return" and '\x0a' is the line feed character.
UPDATE: Can it be that std::string considers "\x0d\x0a" as a single character and thus occupies only one position in the string? Is this '\x0d' a "mystery" character with regard to std::string?
ADDITIONAL INFO: http://en.wikipedia.org/wiki/Newline