[Issue 5543] to!int to see a char as a single-char string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 21 09:54:29 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5543



--- Comment #15 from bearophile_hugs at eml.cc 2012-12-21 09:54:26 PST ---
Having functions in std.ascii (and elsewhere) seems acceptable. But I think the
name of such functions shouldn't be too much long.


to!int raises exceptions. Returning -1 in case of errors seems able to cause
some problems. One common use case for the char->int conversion:

auto s = "123x456";
auto digits = s.map!numericValue().array();

Now I have to scan digits again looking for any -1.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list