Wrong index returned by String.IndexOf () in ProgsEdict.cs in Linux
Brought to you by:
yurykiselev
For it to work on Linux (Ubuntu 14.10 64bit | .net mono v3.2.8) I had to add the following code [file: ProgsEdict.cs Class: Progs Method: StringOffset()]
int offset = _Strings.IndexOf(tmp); // todo: optimize this
if (Environment.OSVersion.Platform == PlatformID.Unix || // new code
Environment.OSVersion.Platform == PlatformID.Unix) // new code
offset -= 1; // new code
For example, in linux "String.IndexOf()" method returns an index "offset = 6633" in the case of Windows "offset = 6632". The correct value is 6632
Greetings, thanks for your work ...
Hi Miguel,
Maybe it is due to '\0' character prepended. Can you also check if overloaded IndexOf(string,StringComparison.Ordinal) works?
Btw, I almost forgot C# since from 2013 I'm java developer.
Yeeesss! Modification work. Sorry to let you to program in C#.
regards
Fixed in r4