I'm trying to print out all the letters in a string until a curly quote is found. However I can't compare a sub-string too a UTF-8 code for comparisons, why is that?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
usingnamespace std;
int main()
{
string words = u8"James says \u201CHi Everyone\u201D ";
for (int i = 0; i < words.length(); i++)
{
if (words.substr(i, 1) == u8"\u201C")
{
break;
}
cout << words.substr(i, 1);
}
return 0;
}