[Mono-dev] Patch for String.cs
Kornél Pál
kornelpal at gmail.com
Wed May 28 16:45:16 EDT 2008
Hi,
I had a look at the patches and I am happy to see these improvements in
String code.
I have found several issues:
> @@ -765,11 +732,13 @@
> if (idx1 == idx2 && len1 == len2 &&
> Object.ReferenceEquals (s1, s2))
> return 0;
> - if (options == CompareOptions.Ordinal)
> - return CompareOrdinal (s1, idx1, len1, s2, idx2, len2);
> + if (options == CompareOptions.Ordinal) {
> + return String.CompareOrdinalCaseInsensitive (s1, idx1, s2, idx2, System.Math.Min (len1, len2));
> + }
> #if NET_2_0
> - if (options == CompareOptions.OrdinalIgnoreCase)
> - return CompareOrdinalIgnoreCase (s1, idx1, len1, s2, idx2, len2);
> + if (options == CompareOptions.OrdinalIgnoreCase) {
> + return String.CompareOrdinal (s1, idx1, s2, idx2, System.Math.Min (len1, len2));
> + }
> #endif
I think that CompareOrdinalCaseInsensitive and CompareOrdinal should be
switched.
> + public int LastIndexOf (String value, int startIndex)
> + {
> + int max = startIndex;
> + if (max < this.Length)
Others reference .length so this is inconsistent.
Kornél
More information about the Mono-devel-list
mailing list