On Thursday, 11 May 2017 at 19:59:55 UTC, Jordan Wilson wrote:
On Thursday, 11 May 2017 at 18:07:47 UTC, H. S. Teoh wrote:
On Thu, May 11, 2017 at 05:55:03PM +0000, k-five via
Digitalmars-d-learn wrote:
On Thursday, 11 May 2017 at 17:18:37 UTC, crimaniak wrote:
> On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote:
---------------------------------------------------------
This reason is why I sometimes use isNumeric if I have heaps of
strings I need to convert, to reduce exceptions. So something
like:
int index = (str.isNumeric) ? to!int(str).ifThrown(0) : 0;
Jordan
--------------------------------------------------------------
Interesting! I was worried about performance and for that I did
not want to use try-catch.
So (isNumberic) is a good solution.
http://dlang.org/phobos/std_traits.html#isNumeric