Some strange behaviors of enums and string.startsWith

Andre via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 8 12:18:00 PDT 2016


On Friday, 8 April 2016 at 14:56:51 UTC, Adam D. Ruppe wrote:
> On Friday, 8 April 2016 at 14:38:10 UTC, Andre wrote:
>> Therefore I use std.conv.text to convert the string enum? to 
>> string.
>
> That converts the *name* of the enum to string, not the 
> contents. (BTW, I think the name of the enum is actually the 
> more useful behavior.)
>
> Use cast(string) if you want to get the content out.

Thanks a lot, now the behavior makes sense.
I will create a feature request for the phobos issue.

Kind regards
André


More information about the Digitalmars-d-learn mailing list