Convert multibyte `string` to `dstring`

Vladimirs Nordholm v at vladde.net
Sun Nov 25 21:23:31 UTC 2018


Hello.

Is there a proper way to convert a string with multibyte 
characters into a dstring?

Case scenario:

     string a = "abc😃123"; // a.length == 10 ("abc"==3 + "😃"==4 + 
"123"==3)
     dstring b = foo(a); // b.length = 7 ("abc"==3 + "😃"==1 + 
"123"==3)

     dstring foo(string str) {
         // code...
     }


More information about the Digitalmars-d-learn mailing list