map on char[] converts to dchar?

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 24 02:16:45 PDT 2017


It is worth noting too that mach's map function will not behave 
this way; UTF encoding and decoding is instructed explicitly and 
is not done implicitly like in phobos.

https://github.com/pineapplemachine/mach.d

     import mach.range : map, asarray;
     import mach.text.ascii : toupper;

     void main(){
         char[] x = ['h', 'e', 'l', 'l', 'o'];
         char[] y = x.map!toupper.asarray();
         assert(y == "HELLO");
     }



More information about the Digitalmars-d-learn mailing list