gilmagno / lingua-pt-br-nums2words Goto Github PK
View Code? Open in Web Editor NEWPerl module. Takes a number and gives back its written form in Brazilian Portuguese
Perl module. Takes a number and gives back its written form in Brazilian Portuguese
NAME Lingua::pt_BR::Nums2Words - Takes a number and gives back its written form in Brazilian Portuguese SYNOPSIS use Lingua::pt_BR::Nums2Words ('num2word'); print num2word(91) # prints 'noventa e um' print num2word('19') # prints 'dezenove' print num2word(1000) # prints 'mil' print num2word(1001) # prints 'mil e um' print num2word(1_001_001) # prints 'um milhão, mil e um' print num2word(1_001_250) # prints 'um milhão, mil duzentos e cinquenta' DESCRIPTION Takes a number and gives back its written form in Brazilian Portuguese. Note: 1000 will produce 'mil', and not 'um mil'. METHODS num2word( $number ) Receives a number and returns it written in words. my $written_number = nums2words(991); print $written_number # prints 'novecentos e noventa e um' INTERNALS These methods should not be used directly (unless you know what you're doing). They are documented here just for the sake of completeness. _make_triads( $number ) Receives a number, splits it in triads (according to the following examples) and returns a list of triads. Examples: 123 turns to the list (123). 12345 turns to the list (12, 345). 1234567 turns to the list (1, 234, 567). _solve_triads( @triads ) Receives a list of triads, calls the function _solve_triad in each of them and apply the "megas" (millions, billions, trillions). _solve_triad( $number ) Receives a number with one to three digits (a triad) and returns it written in words. SEE ALSO Lingua::PT::Nums2Words for pt_PT Portuguese. AUTHOR Gil Magno <[email protected]> THANKS TO Italo Gonçales (cpan:GONCALES) <[email protected]> COPYRIGHT AND LICENSE Copyright (C) 2015 by Gil Magno This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.1 or, at your option, any later version of Perl 5 you may have available.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.