Shouldn't the following code return 4? It is returning -1
string sa = "soy mas grande";
Response.Write("CMP: "+sa.IndexOf("más", StringComparison.InvariantCulture)+"<br>");
Shouldn't the following code return 4? It is returning -1
string sa = "soy mas grande";
Response.Write("CMP: "+sa.IndexOf("más", StringComparison.InvariantCulture)+"<br>");
StringComparison.InvariantCulture
won't strip accents, you may be looking for this:
System.Globalization.CultureInfo.InvariantCulture
.CompareInfo.IndexOf(sa,
"más",
System.Globalization.CompareOptions.IgnoreNonSpace)
No; "más" is not "mas" so it isn't going to match.