April 02, 2006 getting the string representing the enum value | ||||
|---|---|---|---|---|
| ||||
say I have an enum
enum X
{
A,
B,
C
}
and I have
void someFunc( X e )
{
//.. some code
}
I want to print the value of 'e' but I don't want to get a number!! I want to get a string that represents it. i.e. A or B or C
void someFunc( X e )
{
toString(e);
e.string;
e.value;
//or something like that ..
}
Is there any such thing in D?
| ||||
April 02, 2006 Re: getting the string representing the enum value | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy | Woops, I keep posting in the wrong section, sorry just ignore this. :(
Hasan Aljudy wrote:
> say I have an enum
>
> enum X
> {
> A,
> B,
> C
> }
>
> and I have
>
> void someFunc( X e )
> {
> //.. some code
> }
>
> I want to print the value of 'e' but I don't want to get a number!! I want to get a string that represents it. i.e. A or B or C
>
>
> void someFunc( X e )
> {
> toString(e);
> e.string;
> e.value;
> //or something like that ..
> }
>
> Is there any such thing in D?
>
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply