bringToFront() and arrays of char

Jonathan M Davis jmdavisProg at gmx.com
Wed Dec 12 19:22:02 PST 2012


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).

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list