On Sun, 21 Nov 2010 05:58:30 -0500, Nrgyzer nrgy...@gmail.com wrote:
Hello guys,
I have an enumeration which contains symbols of different currencies
like the following:
enum CURRENCY : wchar {
DOLLAR = '$',
EURO = '�',
YEN = ...
}
When I try to append it to a
Hello guys,
I have an enumeration which contains symbols of different currencies
like the following:
enum CURRENCY : wchar {
DOLLAR = '$',
EURO = '�',
YEN = ...
}
When I try to append it to a string like
char[] myString = Currency: ~ CURRENCY.DOLLAR
I get the
Nrgyzer nrgy...@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
When I use an string enumeration, I get the following error (dmd1):
CURRENCY base type must be of integral type, not char[]
Nrgzyer nrgz...@gmail.com wrote:
When I use an string enumeration, I get the following error (dmd1):
CURRENCY base type must be of integral type, not char[]
Ah, you're using D1. Well, a solution would be to use dchar[] instead
of char[].
--
Simen
But for enums I can't use char[] as basetype and when I use cast(dchar)
or cast(wchar) I also get Error: incompatible types for
I solved the problem by using toUTF8 from std.utf but I think it's a
dirty solution because I have to cast wchar to wchar[] because a
simple toUTF8(CURRENCY.DOLLAR) matches wchar[] and dchar[] signatures.