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


monarchdo...@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdo...@gmail.com


--- Comment #3 from monarchdo...@gmail.com 2012-12-21 06:58:42 PST ---
(In reply to comment #2)
> @bear: Please see the comments here:
> https://github.com/D-Programming-Language/phobos/pull/1017
> 
> The feature can be implemented but to!() was rejected, so we need to come up
> with some alternative function names and put them somewhere other than
> std.conv. 
> 
> Personally I don't see how people will be expected to find an obscure function
> name like 'codePointIdx'. This isn't related unicode representation at all,
> there should be no confusion with Unicode when it comes to representing 0-9,
> it's always the same regardless of encoding.

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).

C# and java both implement the methods "getNumericValue". Java even implements
one taking chars, and another taking int (dchar)
http://msdn.microsoft.com/en-us/library/system.char.getnumericvalue.aspx
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Character.html

I'd say we should just add:
std.ascii.getNumericValue
std.uni.getNumericValue
(or plain numericValue)

I already wrote the ascii version (easy as pie), and support for the [Nd]
group, using a binary search, followed by an offset from the lower bound.

[Nl] and [Po] require a straight up mapping of codepoint to value, but I'm
still writing the parser that extract the data for the raw UCD
(http://www.unicode.org/Public/6.2.0/ucdxml/).

The file is too large for std.xml to handle, so it's back to C++ for me :/

The only questions I have is:
Return value: int or double?
Input is not numeric: -1 or exception?

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

Reply via email to