[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 07:08:13 PST 2012


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



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-12-21 07:08:12 PST ---
(In reply to comment #3)
> Well, that's why we have std.ascii, no? For all char operations when we don't
> care about unicode.
> 
> In all fairness, unicode defines "is numeric" (which we already have) and
> "numeric value" (which we *should* have).

Damn Unicode, why does it need to have 10 different ways to represent
something? :)

> The only questions I have is:
> Return value: int or double?

int, because int is implicitly convertible to double, not vice-versa. At least
for the ascii part, if Unicode has code points that represent floating-point
values.. then I really don't understand what Unicode is about anymore.

> Input is not numeric: -1 or exception?

Hmm.. although exceptions are preferred I think for performance reasons we
might consider using -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