Fix issue# 10717.

This makes it so that if you're operating on chars or wchars with
std.ascii functions, you don't have to cast the return values back to
char or wchar, but it still allows you to operate on dchars without
mangling any Unicode values.
lastIndexOf with an index

comments and some tweaking

removed tabs

made the comments nicer

improvments derivated from comments

merge