The IndexOf
function called on a string returns -1
, while there definitely is a match.
string sUpperName = "PROGRAMOZÁSI NYELVEK II. ADA EA+GY. (BSC 08 A)";
string sUpperSearchValue = "N";
sUpperName.IndexOf(sUpperSearchValue); // Returns -1
sUpperSearchValue = "NY";
sUpperName.IndexOf(sUpperSearchValue); // Returns 13
sUpperName[13]; // 78 'N'
sUpperSearchValue[0]; // 78 'N'
sUpperName[13] == sUpperSearchValue[0]; // true
Do you have any idea, why it is that it finds "NY"
but not "N"
by itself? If I search for every other letter in the string, it is able to find it, but not the "N"
.
The same issue appears as well with lower case.
If I type " N"
no match either, at " NY"
it does.
Picture of this in console
In Hungarian .NET Culture the letter combination "ny" stands for a separate letter, so there is no "N" there, only "NY" in your example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With