I
Ivar
Hi,
string s = "aXXa";
Console.WriteLine(s.LastIndexOf("XX",0));
Console.WriteLine(s.LastIndexOf("XX"));
Console.WriteLine(s.IndexOf("XX",0));
Console.WriteLine(s.IndexOf("XX"));
Result:
-1 (LastIndexOf must also return 1, but gives -1) Is it a bug ?
1 - ok
1 - ok
1 - ok
In documentation it says:
Reports the index position of the last occurrence of a specified String
within this instance. The search starts at a specified character position.
string s = "aXXa";
Console.WriteLine(s.LastIndexOf("XX",0));
Console.WriteLine(s.LastIndexOf("XX"));
Console.WriteLine(s.IndexOf("XX",0));
Console.WriteLine(s.IndexOf("XX"));
Result:
-1 (LastIndexOf must also return 1, but gives -1) Is it a bug ?
1 - ok
1 - ok
1 - ok
In documentation it says:
Reports the index position of the last occurrence of a specified String
within this instance. The search starts at a specified character position.