This script transforms a number in words.
It works fine but as I'm a non-native english speaker I don't know if the result is
correct english.
Especially for Billions. A few years ago some english and american friends of mine could
not agree on the value. In the scirpt are thousands of millions.
Hope a reader from Florida of this ng will appreciate. ;-)
I will not say his Name.
Bye.
Giovanni Cenati.


'************************************************
' File: From numbers to letters_test.vbs
' Author: Giovanni Cenati
' my address is at katamail dot com with name Reventlov
'************************************************

'SET FSO = CreateObject("Scripting.FileSystemObject")
'SET TextFile = FSO.CreateTextFile("test.txt", True)
'for i=23400000 to 23401700 step 17
'TextFile.Write i & " " & Trasformainlettere(i)
'TextFile.WriteLine
'next
'msgbox "end test"

A=inputbox("Number to be converted in letters:")
a=inputbox("Converted:",,Trasformainlettere(a))
wscript.quit

'-------------------------------------------------------
'************************************************
' File: Transforms to letters.vbs (function)
' Author: Giovanni Cenati
'
'************************************************
function TrasformaInLettere(byval n)
dim i, dec, lun, lett
dim tri(5)
n=cdbl(n)
num=cstr(fix(n))

Str=cstr("000000000000000000000"&num)
lun=len(Str)
for i=1 to 5
'cuts the string in pieces
tri(i)=mid(Str,lun-(i*3)+1,3)
'The number is now tri(5)& tri(4)& tri(3)& tri(2)& tri(1).
if tri(i)>0 then lett= TrasformaTerzina(tri(i),i) & lett
next
if lett="" then lett="zero" 'manages the zero
TrasformaInLettere= lett
end function

function TrasformaTerzina(tri,t)
'tri is "nnn" to be converted.
't is the number as below::
't=1 if the number is from 1 to 999
't=2 from 1000 to 999000, e.g. the thousands
't=3 are the millions, etc
dim ultimeduecifre,ris,decine,unita
dim n(30) 'all the figures in letters
n(0)=""
n(1)="one":n(2)="two":n(3)="three":n(4)="four":n(5)="five"
n(6)="six":n(7)="seven":n(8)="eight":n(9)="nine":n(10)="ten"
n(11)="eleven":n(12)="twelve":n(13)="thirteen":n(14)="fourteen":n(15)="fifteen"
n(16)="sixteen":n(17)="seventeen":n(18)="eighteeni":n(19)="nineteen"
n(22)="twenty":n(23)="thirty":n(24)="forty":n(25)="fifty"
n(26)="sixty":n(27)="seventy":n(28)="eighty":n(29)="ninety"

'manages the hundreds
if left(tri,1)>0 then ris=n(cint(left(tri,1)))&"hundred"
'if it is nxx then uses n+hundred

'manages numbers from 1 to 19 and from 20 on
Ultimeduecifre=cint(right(tri,2))
if Ultimeduecifre < 20 then
ris=ris&n(Ultimeduecifre) 'from 1 to 19 uses the array "n".
else
'manages separately tens and units from 20 then joins them
Decine=mid(tri,2,1) 'tens
Unita=right(tri,1) 'units
ris=ris & n(20+decine) 'from n(22) is twenty, n(23) is thirty,etc.
Ris=ris & n(Unita) 'adds one, two three...
end if

'manages the position of thousands, millions, etc.
if t=2 then
ris=ris&"thousand"
if tri=1 then ris="onethousand"
end if
if t=3 then
ris=ris&"millions"
if tri=1 then ris="onemillion"
end if
if t=4 then
ris=ris&"billions"
if tri=1 then ris="onebillion"
end if
if t=5 then
ris=ris&"thousandbillions"
if tri=1 then ris="onethoudandbillions"
end if

TrasformaTerzina=Ris
end function
'-------------------------------------------------------


--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com

Re: From numbers to letters. by mr

mr
Mon Nov 01 09:15:20 CST 2004

hi Giovanni,

A thousand millions is called a "Billion" (in American English).

A thousand billions is called a "Trillion".

A thousand trillions is called a "Quadrillion".

For more see this:

http://www.brainyencyclopedia.com/encyclopedia/e/en/english_language_numerals.html

and yes, the usage is different between "English-English" and
"American-English". We here in America haven't spoken "proper" English for
300 years (if then). It is more appropriate to regard "American English" as
a separate language from "English English".

cheers, jw

"Reventlov (at) katamaildot com" <noone@no.void> wrote in message
news:4183ff5d.2851540@powernews.libero.it...
> This script transforms a number in words.
> It works fine but as I'm a non-native english speaker I don't know if the
result is
> correct english.



Re: From numbers to letters. by Tom

Tom
Mon Nov 01 18:23:59 CST 2004

mr unreliable wrote:
> hi Giovanni,
>
> A thousand millions is called a "Billion" (in American English).
>
> and yes, the usage is different between "English-English" and
> "American-English". We here in America haven't spoken "proper" English for
> 300 years (if then). It is more appropriate to regard "American English" as
> a separate language from "English English".
>

a billion is also a thousand million in UK-English



Re: From numbers to letters. by Al

Al
Mon Nov 01 22:21:44 CST 2004


"Tom" <t@chip.ms.NOSPAM> wrote in message
news:uj3BCJHwEHA.3620@TK2MSFTNGP09.phx.gbl...
> mr unreliable wrote:
> > hi Giovanni,
> >
> > A thousand millions is called a "Billion" (in American English).
> >
> > and yes, the usage is different between "English-English" and
> > "American-English". We here in America haven't spoken "proper" English
for
> > 300 years (if then). It is more appropriate to regard "American
English" as
> > a separate language from "English English".
> >
>
> a billion is also a thousand million in UK-English

Somewhere I heard that, when multiplying by thousands, the sequence is:

millions
milliards
billions

A quick google search suggests the following:

it is a french term: http://en.wikipedia.org/wiki/Milliard

it is an english term: http://www.thefreedictionary.com/milliard

it is british, french, and/or german:
http://mathworld.wolfram.com/Milliard.html

Where this leaves "trillions" seems to be given by:
http://mathworld.wolfram.com/Trillion.html

Not sure where this leave "billiards", but perhaps the answer can be
explained by the Milliard family: http://tinyurl.com/3jmvv. Or possibly:
http://members.aol.com/Philosdog/Nature.html.

If you really want to get into this, try:
http://www.sizes.com/numbers/big_numName.htm. If that becomes too heavy, and
you want to relapse from numbers into clever words, see:
http://www.aero.iitb.ac.in/~avijit/grooks1.html


/Al



Re: From numbers to letters. by Al

Al
Mon Nov 01 22:27:44 CST 2004


"Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> wrote in message
news:e5Xg3NJwEHA.2908@tk2msftngp13.phx.gbl...
>
> "Tom" <t@chip.ms.NOSPAM> wrote in message
> news:uj3BCJHwEHA.3620@TK2MSFTNGP09.phx.gbl...
> > mr unreliable wrote:
> > > hi Giovanni,
> > >
> > > A thousand millions is called a "Billion" (in American English).
> > >
> > > and yes, the usage is different between "English-English" and
> > > "American-English". We here in America haven't spoken "proper"
English
> for
> > > 300 years (if then). It is more appropriate to regard "American
> English" as
> > > a separate language from "English English".
> > >
> >
> > a billion is also a thousand million in UK-English

Perhaps this thread suggests the possibility that converting from an
explicit numeric representation to a word representation of a quantity may
suffer from the obvious ambiguity. Thank goodness for commas and scientific
notation, though.

/Al

> Somewhere I heard that, when multiplying by thousands, the sequence is:
>
> millions
> milliards
> billions
>
> A quick google search suggests the following:
>
> it is a french term: http://en.wikipedia.org/wiki/Milliard
>
> it is an english term: http://www.thefreedictionary.com/milliard
>
> it is british, french, and/or german:
> http://mathworld.wolfram.com/Milliard.html
>
> Where this leaves "trillions" seems to be given by:
> http://mathworld.wolfram.com/Trillion.html
>
> Not sure where this leave "billiards", but perhaps the answer can be
> explained by the Milliard family: http://tinyurl.com/3jmvv. Or possibly:
> http://members.aol.com/Philosdog/Nature.html.
>
> If you really want to get into this, try:
> http://www.sizes.com/numbers/big_numName.htm. If that becomes too heavy,
and
> you want to relapse from numbers into clever words, see:
> http://www.aero.iitb.ac.in/~avijit/grooks1.html
>
>
> /Al
>
>