Im trying to compare these two chars but on win 32 Visual Studio 2008:
if(mychar1 == 'ä' || mychar2 == 'Ä')
Erromess:
Debug Assertion Failed!
File:f\dd\vctools\crt_bld\self_x86\crt\src\xstring
Line 1575
Expression: string subscript out of range
Works on my machine:
Note that the error you quote (“string subscript out of range”) implies that you try to access a character in a string at an invalid index. Something like
my_str.at(10)(or, in a Debug build,my_str[10]), wheremy_stronly has 10 characters. Since the code you showed doesn’t access characters in strings, the error is in code you don’t show.Edit: The code you showed in a comment to your question does access characters in a string using
operator[](). When you dostring2[0], have you checked that the string isn’t empty?