Append wchar enumeration to string
Simen kjaeraas
simen.kjaras at gmail.com
Sun Nov 21 07:10:57 PST 2010
Nrgyzer <nrgyzer at gmail.com> wrote:
> But... when I try the following:
>
> char[] myString = "Currency: " ~ cast(char) CURRENCY.DOLLAR
>
> It works, but not for all currencies.
> What can I do to support all currencies?
The problem is that not all UTF-8 code points fit in one char.
I would recommend in this situation to use a string enum:
enum CURRENCY : string {
DOLLAR = "$",
EURO = "€",
YEN = ...
}
--
Simen
More information about the Digitalmars-d-learn
mailing list