NAME

Lingua::EO::Numbers - Convert numbers into Esperanto words

VERSION

This document describes Lingua::EO::Numbers version 0.03.

SYNOPSIS

use 5.010;
use Lingua::EO::Numbers qw( num2eo );

for my $nombro (reverse 0 .. 99) {
    say ucfirst num2eo($nombro), ' boteloj da biero sur la muro.';
}

output:

Naŭdek naŭ boteloj da biero sur la muro.
Naŭdek ok boteloj da biero sur la muro.
Naŭdek sep boteloj da biero sur la muro.
  ...
Nul boteloj da biero sur la muro.

DESCRIPTION

This module provides functions to convert numbers into words in Esperanto, a constructed international auxiliary language created by L. L. Zamenhof and published in 1887.

This module currently supports the standard Esperanto decimal separator (",") or the standard Perl one (".") and does not support any thousands separator. The option to set the supported decimal and thousands separators may be added in the future.

FUNCTIONS

The following functions are provided but are not exported by default.

num2eo EXPR

If EXPR looks like a number, the text describing the number is returned. Both integers and real numbers are supported, including negatives. Special values such as "inf" and "NaN" are also supported.

num2eo_ordinal EXPR

If EXPR looks like an integer, the text describing the number in ordinal form is returned. The behavior when passing a non-integer value is undefined.

The returned string is UTF-8 encoded. If EXPR is a value that does not look like a number or is not currently supported by this module, undef is returned.

The :all tag can be used to import all functions.

use Lingua::EO::Numbers qw( :all );

TODO

  • support exponential notation

  • option for setting the input decimal separator

  • option for setting the input thousands separator

SEE ALSO

Lingua::EO::Numbers::EO, Lingua::Conlang::Numbers, http://bertilow.com/pmeg/gramatiko/nombroj/, utf8, Lingua::EO::Orthography

AUTHOR

Nick Patch <patch@cpan.org>

ACKNOWLEDGEMENTS

MORIYA Masaki (Gardejo) created the Esperanto translation of this document.

COPYRIGHT AND LICENSE

Copyright 2009, 2010 Nick Patch

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