Re: nothrow function to tell if a string can be converted to a number?

2013-09-11 Thread Timothee Cour
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

Re: nothrow function to tell if a string can be converted to a number?

2013-09-11 Thread H. S. Teoh
On Wed, Sep 11, 2013 at 02:10:32PM -0700, Timothee Cour wrote: 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; Yikes! This makes me *extremely* glad

Re: nothrow function to tell if a string can be converted to a number?

2013-09-11 Thread Timothee Cour
anyways, isNumeric sounds buggy, isn't it? On Wed, Sep 11, 2013 at 4:03 PM, H. S. Teoh hst...@quickfur.ath.cx wrote: On Wed, Sep 11, 2013 at 02:10:32PM -0700, Timothee Cour wrote: actually that doesn't work: assert(!isNumeric(`j`)); //ok assert(!isNumeric(`i`)); //fails ; i is treated

Re: nothrow function to tell if a string can be converted to a number?

2013-09-11 Thread H. S. Teoh
On Wed, Sep 11, 2013 at 08:15:26PM -0700, Timothee Cour wrote: anyways, isNumeric sounds buggy, isn't it? Yeah, I'd file a bug. I can't see how i can possibly be numeric. I thought the compiler rejected that anyway? On Wed, Sep 11, 2013 at 4:03 PM, H. S. Teoh hst...@quickfur.ath.cx wrote:

Re: nothrow function to tell if a string can be converted to a number?

2013-09-08 Thread Timothee Cour
On Fri, Sep 6, 2013 at 9:38 PM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Friday, September 06, 2013 21:15:44 Timothee Cour wrote: I'd like to have a function: @nothrow bool isNumberLitteral(string a); unittest{ assert(isNumberLitteral(1.2)); assert(!isNumberLitteral(a1.2));

Re: nothrow function to tell if a string can be converted to a number?

2013-09-08 Thread Timothee Cour
sorry I was a bit sloppy in my previous post. Here it is corrected: I was also curious whether there's functionality for the following (I wrote my own versions but they might not consider all cases) bool isStringLitteral(string); //tests whether a string represents a string litteral unittest{

Re: nothrow function to tell if a string can be converted to a number?

2013-09-07 Thread Jonathan M Davis
On Friday, September 06, 2013 22:38:20 H. S. Teoh wrote: On Sat, Sep 07, 2013 at 12:38:58AM -0400, Jonathan M Davis wrote: On Friday, September 06, 2013 21:15:44 Timothee Cour wrote: I'd like to have a function: @nothrow bool isNumberLitteral(string a); unittest{

nothrow function to tell if a string can be converted to a number?

2013-09-06 Thread Timothee Cour
I'd like to have a function: @nothrow bool isNumberLitteral(string a); unittest{ assert(isNumberLitteral(1.2)); assert(!isNumberLitteral(a1.2)); assert(!isNumberLitteral(a.b)); } I want it nothrow for efficiency (I'm using it intensively), and try/catch as below has significant runtime