[Mono-bugs] [Bug 77412][Maj] New - String.LastIndexOf returns -1 when the search string is the entire main string

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jan 30 18:34:48 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by nlassonde at versora.com.

http://bugzilla.ximian.com/show_bug.cgi?id=77412

--- shadow/77412	2006-01-30 18:34:47.000000000 -0500
+++ shadow/77412.tmp.3023	2006-01-30 18:34:47.000000000 -0500
@@ -0,0 +1,59 @@
+Bug#: 77412
+Product: Mono: Class Libraries
+Version: 1.1
+OS: NLD 9
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: NLassonde at Versora.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: String.LastIndexOf returns -1 when the search string is the entire main string
+
+I don't know if this is related to bug #62160, but seeing as how I'm seeing
+this with Mono 1.1.13.2 on NLD 9 (and also saw it on Mono 1.1.7 on NLD 9),
+I think it's different.
+
+The bug is that String.LastIndexOf returns -1 when the string you're
+searching for is the entire string that you're searching in. To reproduce:
+
+---
+
+using System; 
+ 
+namespace MonoTest 
+{ 
+    public class Test 
+    { 
+	public static void Main(String[] args) 
+	{ 
+	    string text = "test123"; 
+	    Console.WriteLine("text=\"{0}\"", text); 
+	    Console.WriteLine("text.IndexOf(\"test123\")={0}", 
+text.IndexOf("test123")); 
+	    Console.WriteLine("text.LastIndexOf(\"test123\")={0}", 
+text.LastIndexOf("test123")); 
+	} 
+    } 
+}
+
+---
+
+Actual Results: 
+ 
+text="test123" 
+text.IndexOf("test123")=0 
+text.LastIndexOf("test123")=-1 
+ 
+ 
+Expected Results: 
+  
+text="test123" 
+text.IndexOf("test123")=0 
+text.LastIndexOf("test123")=0


More information about the mono-bugs mailing list