++ed by:
Zakariyya Mughal

NAME

Unicode::Number - handle numerals in Unicode using the libuninum library

VERSION

version 0.009

SYNOPSIS

  use Unicode::Number;

  my $u = Unicode::Number->new;
  my $lao_str = "\x{0ED5}\x{0ED7}\x{0ED6}";
  my $ns = $u->guess_number_system($lao_str);
  say $u->string_to_number($ns, $lao_str)->to_string; # 576

DESCRIPTION

This class is used to interface with the libuninum library to convert to and from different number system representations. It can be used to convert from a UTF-8 string to one of the types supported by Unicode::Number::Result.

METHODS

new

new()

Returns a new instance of Unicode::Number.

number_systems

number_systems()

Returns an arrayref of Unicode::Number::System instances.

get_number_system_by_name

get_number_system_by_name($name)

Returns the Unicode::Number::System that has the name given by the $name parameter (string) or undef if not found.

string_to_number

string_to_number($number_system, $digits_string)

Returns a Unicode::Number::Result that contains the results of converting the string given in the $digits_string parameter to a number in the number system represented by the $number_system parameter.

The value of $number_system can either be a Unicode::Number::System instance or a string (see get_number_system_by_name.)

The value of $digits_string must be encoded in UTF-8.

number_to_string

number_to_string($number_system, $number)

Returns a UTF-8 encoded string that represents the value of $number in the number system represented by $number_system.

The value of $number_system can either be a Unicode::Number::System instance or a string (see get_number_system_by_name.)

The value of $number can be either a numeric integer value or a string that matches the regular expression /[0-9]+/.

guess_number_system

guess_number_system($digits_string)

Returns the Unicode::Number::System that matches the contents of the numbers in the string $digits_string if it can be found.

In the special case when $digits_string contains only '0', then it returns a Unicode::Number::System with the name 'All_Zero' because several number systems make overlapping use of this glyph.

Otherwise, if the number system is unknown, returns undef.

The value of $digits_string must be encoded in UTF-8.

version

version()

Returns a string with the version of the libuninum library.

SEE ALSO

libuninum

CLDR::Number

AUTHOR

Zakariyya Mughal <zmughal@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Zakariyya Mughal.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.




Hosting generously
sponsored by Bytemark