true if success and false otherwise.
import std.meta: AliasSeq; foreach (T; AliasSeq!(byte, ubyte, short, ushort, int, uint, long, ulong)) { auto str = "123"; T val; assert(parse(str, val)); assert(val == 123); str = "0"; assert(parse(str, val)); assert(val == 0); str = "9"; assert(parse(str, val)); assert(val == 9); str = ""; assert(!parse(str, val)); assert(val == 0); str = "text"; assert(!parse(str, val)); assert(val == 0); }
import std.meta: AliasSeq; foreach (T; AliasSeq!(byte, short, int, long)) { auto str = "-123"; T val; assert(parse(str, val)); assert(val == -123); str = "-0"; assert(parse(str, val)); assert(val == 0); str = "-9text"; assert(parse(str, val)); assert(val == -9); assert(str == "text"); enum m = T.min + 0; str = m.stringof; assert(parse(str, val)); assert(val == T.min); }
Integer parsing utilities.