more naming

Nick Sabalausky a at a.a
Sat Jan 22 15:02:54 PST 2011


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:ihf0kc$2fqj$1 at digitalmars.com...
> OK, so we have replace(haystack, needle, nail) which replaces _all_ 
> occurrences of needle in haystack with nail. How would you call a function 
> that replaces only the _first_ occurrence of needle with nail?
>
> Must be a distinct function, not a runtime parameter to the existing 
> function. This is because the function that replaces only one occurrence 
> only requires nail to be an input range.
>

replaceFirst

As for the question of renaming "replace" to "replaceAll", I'd lean more 
towards "replace", but I honestly don't actually care either way.




More information about the Digitalmars-d mailing list