Re: Converting from string to enum by name

2012-05-29 Thread Jarl André
On Monday, 28 May 2012 at 18:53:50 UTC, Ali Çehreli wrote: On 05/28/2012 11:50 AM, "Jarl André" " wrote: > 1. Is there a way to convert from string "INFO" to LogLevel.INFO, by name? conv.to can do that: import std.conv; enum LogLevel { ALL, INFO, WARNING } void main() { enum l = to!LogL

Converting from string to enum by name

2012-05-28 Thread Jarl André
Hi I have a project on github, https://github.com/jarlah/d2-simple-socket-server, where I have added very custom logger library. In this logger library I have an enum LogLevel that looks like enum LogLevel { ALL, INFO, WARNING etc } Questions: 1. Is there a way to convert from string "INFO