About std.ascii.toLower
Jonathan M Davis
jmdavisProg at gmx.com
Fri Sep 21 03:46:02 PDT 2012
On Friday, September 21, 2012 12:38:07 monarch_dodra wrote:
> On Friday, 21 September 2012 at 10:23:39 UTC, Jonathan M Davis
>
> wrote:
> > On Friday, September 21, 2012 11:00:31 monarch_dodra wrote:
> >> What do you (you two) think of my proposition for a
> >> "std.strictascii" module?
> >
> > I don't think that it's at all worth it. It's just duplicate
> > functionality in
> > order to avoid a cast.
>
> (and contract)
If that's what you want, it's easy enough to create a helper function which
you use instead of a cast which does the contract check as well. e.g.
char toChar(dchar c)
{
assert(isAscii(c));
return cast(char)c;
}
foreach(ref char c; str)
c = toChar(std.ascii.toLower(c));
It should be completely optimized out with -release and -inline.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list