add range version of setExtension

Since Walter is being unresponsive, I'm hijacking his [original PR](https://github.com/D-Programming-Language/phobos/pull/2149). This PR basically uses Walter's code as base, and adds some fixes on top per reviewers' comments.
You're right, it does. :-( Scary how long it took for the discussion in this PR to actually start talking about the code...

Looks like we're gonna need a range version of `stripExtension` too.