NAME

Lingua::RO::Numbers - Convert numeric values into their Romanian string equivalents and viceversa

VERSION

Version 0.22

SYNOPSIS

use Lingua::RO::Numbers qw(number_to_ro ro_to_number);
print number_to_ro(315);
# prints: 'trei sute cincisprezece'

print ro_to_number('trei sute douazeci si cinci virgula doi');
# prints: 325.2

DESCRIPTION

Lingua::RO::Numbers converts arbitrary numbers into human-readable Romanian text and viceversa, converting arbitrary Romanian text into its corresponding numerical value.

EXPORT

Nothing is exported by default. Only the functions number_to_ro() and ro_to_number() are exportable.

new(;%opt)

Initialize an object.

my $obj = Lingua::RO::Numbers->new();

is equivalent with:

my $obj = Lingua::RO::Numbers->new(
                  diacritics          => 1,
                  invalid_number      => undef,
                  negative_sign       => 'minus',
                  decimal_point       => 'virgulă',
                  thousands_separator => '',
                  infinity            => 'infinit',
                  not_a_number        => 'NaN',
          );
number_to_ro($number)

Converts a number to its Romanian string representation.

# Functional oriented usage
$string = number_to_ro($number);
$string = number_to_ro($number, %opts);

# Object oriented usage
my $obj = Lingua::RO::Numbers->new(%opts);
$string = $obj->number_to_ro($number);

# Example:
print number_to_ro(98_765, thousands_separator => q{,});
  #=> 'nouăzeci și opt de mii, șapte sute șaizeci și cinci'
ro_to_number($text)

Converts a Romanian text into its numeric value.

# Functional oriented usage
$number = ro_to_number($text);
$number = ro_to_number($text, %opts);

# Object oriented usage
my $obj = Lingua::RO::Numbers->new(%opts);
$number = $obj->ro_to_number($text);

# Example:
print ro_to_number('patruzeci si doi');  #=> 42

AUTHOR

Daniel Șuteu, <trizen at protonmail.com>

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Lingua::RO::Numbers

REPOSITORY

https://github.com/trizen/Lingua-RO-Numbers

REFERENCES

http://ro.wikipedia.org/wiki/Sistem_zecimal#Denumiri_ale_numerelor

LICENSE AND COPYRIGHT

Copyright 2013-2018 Daniel Șuteu.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0