On Monday, 13 January 2014 at 12:53:08 UTC, Regan Heath wrote:
or less what you might call std.string.contains (which does not exist - instead we'd use indexOf != -1.. I think).

Just a side track:

What I dislike about return values as error-indicators is that they are arbitrary so you have to memorize "-1", "0", null, throws…

I think it is often useful to have user-supplied default and sensible naming like having functions that allow testing for "0","false","null" as failure ending with "OK" in their name. And functions that throws ought to have some kind of assertive name like "validate" or a name that explicitly hints at exceptions.

"-1" is really a horrible error value since it fails the "boolean test", and e.g. if you want the non-query part of an url, you want string length to be the "not found value" when searching for "?", not -1:

"http://server.com/page";
"http://server.com/page?query=xyz";

Reply via email to