std.string.indexOf with an optional start-at parameter?

Aleksandar Ružičić ruzicic.aleksandar at gmail.com
Sun Apr 3 11:29:04 PDT 2011


On Sun, Apr 3, 2011 at 8:16 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> It's not.

Seems I've missed that in the docs, I tought it will always make a copy :)

> I think that's a natural and simple improvement of indexOf. The one aspect
> that I'm unsure about is starting from the end for negative indices.

Negative indices might seem a bit odd but it's standard in other
languages (like javascript and php which I've already mentioned).
I would even like to see this in D:

array[-2];  // get 'a' from "foobar"

same for slicing:

array[-4..2];  // get "ob" from "foobar"

> Could you please submit an enhancement request to bugzilla?

sure!


More information about the Digitalmars-d mailing list