[Mono-list] Bug in String.IndexOf ?
Atsushi Eno
atsushi at ximian.com
Fri Nov 10 22:35:12 EST 2006
Hi,
It looks like a bug. I'll take a look later. Thanks.
Atsushi Eno
Pedro Castro wrote:
> Running String.IndexOf with the StringComparison.Ordinal option
> doesn't seem to produce correct results. However, using
> CompareInfo.IndexOf does work. Test:
>
> #############################################
> using System;
> using System.Globalization;
>
> public class Test {
>
> public static void Main () {
> string text = "testing123456";
> string text2 = "123";
> System.Console.WriteLine(text.IndexOf(text2, StringComparison.Ordinal));
> CompareInfo compare = CultureInfo.InvariantCulture.CompareInfo;
> System.Console.WriteLine(compare.IndexOf(text, text2,
> CompareOptions.Ordinal));
>
> }
>
> }
> #############################################
>
> The output:
> -1
> 7
>
More information about the Mono-list
mailing list