bringToFront() and arrays of char

Dmitry Olshansky dmitry.olsh at gmail.com
Thu Dec 13 12:27:39 PST 2012


12/13/2012 7:22 AM, Jonathan M Davis пишет:
> On Wednesday, December 12, 2012 17:34:53 Ali Çehreli wrote:
>> (There must be an easier way of doing that. :))
>
> If you have a string that's really ASCII and you're _sure_ that it's only
> ASCII, then I'd suggest simply casting it to immutable(ubyte)[] and operating
> on that with all range based functions. That way, no decoding occurs, and you
> don't have to dup the string. If you want, you could also easily create a
> funtion called something like assumeASCII that did that cast in order to make
> it more idiomatic (similar to std.exception.assumeUnique).
>

Yup. Plus there is a not commonly known 'representation' function that 
does just that for (w|d|)string:

auto repro = lowercase.representation;
//typeof(repro) should be immutable(ubyte)[]



-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list