Converting from string to enum by name
Ali Çehreli
acehreli at yahoo.com
Mon May 28 11:53:46 PDT 2012
On 05/28/2012 11:50 AM, "Jarl André" <jarl.andre at gmail.com>" 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!LogLevel("INFO");
assert(l == LogLevel.INFO);
}
> 2. does it really not exist any functional logging libraries for D2?
There has been discussions about that not too long ago.
Ali
--
D Programming Language Tutorial: http://ddili.org/ders/d.en/index.html
More information about the Digitalmars-d-learn
mailing list