Append wchar enumeration to string

Nrgyzer nrgyzer at gmail.com
Sun Nov 21 02:58:30 PST 2010


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 following error: "Error: incompatible types for... 'char[]'
and 'int'"

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?

Thanks for any help.


More information about the Digitalmars-d-learn mailing list