PHP Classes

Num2Txt: Convert a number to Spanish text

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 88 All time: 9,980 This week: 69Up
Version License PHP version Categories
num2txt 1.0.1The PHP License5PHP 5, Text processing, Math
Description 

Author

This package is specific mainly for applications used in Spain Spain .

This class can convert a number to Spanish text.

It can take a number and returns a text string that spells the number with words in Spanish.

The class can spell a number of less than 1,000,000,000,000 .

Picture of Antonio Leiva
  Performance   Level  
Name: Antonio Leiva <contact>
Classes: 2 packages by
Country: Spain Spain
Age: 53
All time rank: 377599 in Spain Spain
Week rank: 178 Up6 in Spain Spain Up

Documentation

Num2Txt

Two simple classes for convert a number to spanish text.

Examples:

C

string txt1 = Alp3476.A2Num2Txt.ToString("3528.25");
Console.WriteLine(txt1);
// tres mil quinientos veintiocho con veinticinco

string txt2 = Alp3476.A2Num2Txt.ToString(123456);
Console.WriteLine(txt2);
// ciento veintitres mil cuatrocientos cincuenta y seis

string txt3 = Alp3476.A2Num2Txt.ToString(-258241.2);
Console.WriteLine(txt3);
// menos doscientos cincuenta y ocho mil doscientos cuarenta y uno con veinte

PHP

include 'Num2Txt.php';

$o = new  \Alp3476\Num2Txt();
echo $o->toString(3527.25) . PHP_EOL;
// tres mil quinientos veintisiete con veinticinco

echo $o->toString(12342245281.890) . PHP_EOL;
// doce mil trescientos cuarenta y dos millones doscientos cuarenta y cinco mil doscientos ochenta y uno con ochenta y nueve

echo $o->toString(0.253) . PHP_EOL;
// cero con veinticinco

Note:

Trim decimals to 2 digits


  Files folder image Files (4)  
File Role Description
Files folder imagec-sharp (1 file)
Files folder imagephp (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (4)  /  c-sharp  
File Role Description
  Accessible without login Plain text file Num2Txt.cs Data Auxiliary data

  Files folder image Files (4)  /  php  
File Role Description
  Plain text file Num2Txt.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:88
This week:0
All time:9,980
This week:69Up