I am upgrading one of the net framework project to net5, observed a change in behavior of a same line of code in net framework vs net5. For example if I have a text wit EOT, net5 doesn't give the index but the same works in net framework project.
string sampleString = "hello" "\u0004" "test";
string delimiter = "\u0004";
var test = sampleString.IndexOf(delimiter);
\\Net framework gives a index **5**
\\Net core gives a index **0** for the code
Any reason for this change in behavior?
CodePudding user response:
try this
string delimiter = "\u0004";
string sampleString = "hello" delimiter "test";
var uniCodeValue = char.Parse(delimiter);// '\u0004' unicode values
var test = sampleString.IndexOf(uniCodeValue); //5
test = sampleString.IndexOf("test"); //6