[Mono-bugs] [Bug 687444] String.Compare incompatible with .net on strings ending with '\0'

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 14 05:59:50 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=687444

https://bugzilla.novell.com/show_bug.cgi?id=687444#c3


Kornél Pál <kornelpal at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |kornelpal at gmail.com
         Resolution|FIXED                       |

--- Comment #3 from Kornél Pál <kornelpal at gmail.com> 2011-04-14 09:59:49 UTC ---
I can confirm that MS.NET indeed does behave as described by Nicklas.

string str1 = "abc\0";
string str2 = "abc";
Console.WriteLine(str1.Length);
Console.WriteLine(str2.Length);
Console.WriteLine(string.Compare(str1, str2,
StringComparison.InvariantCulture));
Console.WriteLine(string.Compare(str1, str2,
StringComparison.InvariantCultureIgnoreCase));
Console.WriteLine(string.Compare(str1, str2, StringComparison.Ordinal));
Console.WriteLine(string.Compare(str1, str2,
StringComparison.OrdinalIgnoreCase));


Output on .NET Framework 4.0:
4
3
0
0
1
1

This bug is definitely not fixed if you really want to close it, won't fix is a
better choice although I belive that this would affect compatibility with
MS.NET and don't support closing it as won't fix.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list