actually that doesn't work:
assert(!isNumeric(`j`)); //ok
assert(!isNumeric(`i`)); //fails ; i is treated as a complex number but that's not good behavior as we can't write auto a=i;
assert(isNumeric(`1e2`)); // fails even though we can write auto a=1e2;
In contrast, what I had worked (passes those asserts) but only throws on certain occasions (doesn't always throw on false).
bool isNumberLitteral(T=double)(string a){
import std.conv;
//ugly hack to avoid throwing most of the time;
if(!a.length||a==".")
return false;
string s="0"~a;
auto x=parse!T(s);
return s.length==0;
}
I'd like to get a version that never throws.