Skip to content

Instantly share code, notes, and snippets.

@cowens
Created May 21, 2009 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowens/115461 to your computer and use it in GitHub Desktop.
Save cowens/115461 to your computer and use it in GitHub Desktop.
package Unicode::Digits;
use Exporter 'import';
our @EXPORT = qw(digits_to_int);
my %h;
@h{0x00000030 .. 0x00000039} = (0 .. 9);
@h{0x00000660 .. 0x00000669} = (0 .. 9);
@h{0x000006f0 .. 0x000006f9} = (0 .. 9);
@h{0x000007c0 .. 0x000007c9} = (0 .. 9);
@h{0x00000966 .. 0x0000096f} = (0 .. 9);
@h{0x000009e6 .. 0x000009ef} = (0 .. 9);
@h{0x00000a66 .. 0x00000a6f} = (0 .. 9);
@h{0x00000ae6 .. 0x00000aef} = (0 .. 9);
@h{0x00000b66 .. 0x00000b6f} = (0 .. 9);
@h{0x00000be6 .. 0x00000bef} = (0 .. 9);
@h{0x00000c66 .. 0x00000c6f} = (0 .. 9);
@h{0x00000ce6 .. 0x00000cef} = (0 .. 9);
@h{0x00000d66 .. 0x00000d6f} = (0 .. 9);
@h{0x00000e50 .. 0x00000e59} = (0 .. 9);
@h{0x00000ed0 .. 0x00000ed9} = (0 .. 9);
@h{0x00000f20 .. 0x00000f29} = (0 .. 9);
@h{0x00001040 .. 0x00001049} = (0 .. 9);
@h{0x000017e0 .. 0x000017e9} = (0 .. 9);
@h{0x00001810 .. 0x00001819} = (0 .. 9);
@h{0x00001946 .. 0x0000194f} = (0 .. 9);
@h{0x000019d0 .. 0x000019d9} = (0 .. 9);
@h{0x00001b50 .. 0x00001b59} = (0 .. 9);
@h{0x0000d830 .. 0x0000d839} = (0 .. 9);
@h{0x0000d870 .. 0x0000d879} = (0 .. 9);
@h{0x0000d8b0 .. 0x0000d8b9} = (0 .. 9);
@h{0x0000d8f0 .. 0x0000d8f9} = (0 .. 9);
@h{0x0000d930 .. 0x0000d939} = (0 .. 9);
@h{0x0000d970 .. 0x0000d979} = (0 .. 9);
@h{0x0000d9b0 .. 0x0000d9b9} = (0 .. 9);
@h{0x0000d9f0 .. 0x0000d9f9} = (0 .. 9);
@h{0x0000da30 .. 0x0000da39} = (0 .. 9);
@h{0x0000da70 .. 0x0000da79} = (0 .. 9);
@h{0x0000dab0 .. 0x0000dab9} = (0 .. 9);
@h{0x0000daf0 .. 0x0000daf9} = (0 .. 9);
@h{0x0000db30 .. 0x0000db39} = (0 .. 9);
@h{0x0000db70 .. 0x0000db79} = (0 .. 9);
@h{0x0000dbb0 .. 0x0000dbb9} = (0 .. 9);
@h{0x0000dbf0 .. 0x0000dbf9} = (0 .. 9);
@h{0x0000dc30 .. 0x0000dc39} = (0 .. 9);
@h{0x0000dc70 .. 0x0000dc79} = (0 .. 9);
@h{0x0000dcb0 .. 0x0000dcb9} = (0 .. 9);
@h{0x0000dcf0 .. 0x0000dcf9} = (0 .. 9);
@h{0x0000dd30 .. 0x0000dd39} = (0 .. 9);
@h{0x0000dd70 .. 0x0000dd79} = (0 .. 9);
@h{0x0000ddb0 .. 0x0000ddb9} = (0 .. 9);
@h{0x0000ddf0 .. 0x0000ddf9} = (0 .. 9);
@h{0x0000de30 .. 0x0000de39} = (0 .. 9);
@h{0x0000de70 .. 0x0000de79} = (0 .. 9);
@h{0x0000deb0 .. 0x0000deb9} = (0 .. 9);
@h{0x0000def0 .. 0x0000def9} = (0 .. 9);
@h{0x0000df30 .. 0x0000df39} = (0 .. 9);
@h{0x0000df70 .. 0x0000df79} = (0 .. 9);
@h{0x0000dfb0 .. 0x0000dfb9} = (0 .. 9);
@h{0x0000dff0 .. 0x0000dff9} = (0 .. 9);
@h{0x0000ff10 .. 0x0000ff19} = (0 .. 9);
@h{0x000104a0 .. 0x000104a9} = (0 .. 9);
@h{0x0001d7ce .. 0x0001d7ff} = (0 .. 9) x 5;
sub digits_to_int {
my $digits = shift;
my $int = '';
for my $digit (map ord, split //, $digits) {
$int .= $h{$digit};
}
return $int;
}
"this is not an interesting return value";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment