You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IndexOf method of string class is returning different results on macOs and Windows.
This issue started after .NET Core release update.
var str = "The quick brown fox jumps over the lazy dog\r\n";
if (str.IndexOf("\n") >= 0) {
Console.WriteLine("OK");
}
else {
Console.WriteLine("BAD");
}
On Windows machine it always print: OK
On Mac it prints: BAD
I fixed my code passing a char to IndexOf instead string: if (str.IndexOf('\n') >= 0)
But would be better if both platform to work consistently.
Thanks
PS: I had posted this issue on core repository (dotnet/core#193)
The text was updated successfully, but these errors were encountered:
IndexOf method of string class is returning different results on macOs and Windows.
This issue started after .NET Core release update.
On Windows machine it always print:
OK
On Mac it prints:
BAD
I fixed my code passing a char to IndexOf instead string:
if (str.IndexOf('\n') >= 0)
But would be better if both platform to work consistently.
Thanks
PS: I had posted this issue on core repository (dotnet/core#193)
The text was updated successfully, but these errors were encountered: