dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]String.LastIndexOf(String s) brain damage...


From: Jonathan P Springer
Subject: [DotGNU]String.LastIndexOf(String s) brain damage...
Date: Mon, 11 Nov 2002 13:11:38 -0500
User-agent: Mutt/1.4i

I've spent today banging my head against the ECMA specs for
String.LastIndexOf and while I don't agree with them, I'm beginning to
understand them.

Unfortunately, I can't tell whether I'm coming or going at this point,
so I need a second opinion...

static void Main() {

        String s = "foobar";
        int x = s.LastIndexOf("foo");
        int y = s.LastIndexOf("oba");

        System.Console.WriteLine(x + "," + y);
}

What's the output?  "0,2" or "2,4"?  My preference would be the former,
but the specs are ambiguous and confused enough that I could be easily
convinced that #2 is what should be produced.

Test cases await...
-js

-- 
-Jonathan P Springer <address@hidden>
------------------------------------------------------------------------------
"A standard is an arbitrary solution to a recurring problem." - Joe Hazen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]