Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 3rd, 2003, 07:19 AM
Registered User
 
Join Date: Sep 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Rs. figure conversion into words

Is there any inbuilt function in ASP to convert figure (digit)
into Words

example : figure --> 438908
 in words -->Four lacks thirty eight thousand nine hundred and eight



 
Old October 4th, 2003, 04:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Nope, this is not supported by default.

However, creating a custom function that does this shouldn't be too hard. You'll need to figure out how large the number is, and how large each individual number is (the 3 in 312 is 3 hundred, while it's 3 thousand in 3912).

If you need some help creating this function, just post your questions here.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 6th, 2003, 02:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A guy called Mat Tillet wrote this (mat at fusioninternet.co.uk)


<%
Function Number_to_Text(number)
Dim arrUnit(19), arrTens(8), arrHundred(2)

arrUnit(0) = ""
arrUnit(1) = "One"
arrUnit(2) = "Two"
arrUnit(3) = "Three"
arrUnit(4) = "Four"
arrUnit(5) = "Five"
arrUnit(6) = "Six"
arrUnit(7) = "Seven"
arrUnit(8) = "Eigth"
arrUnit(9) = "Nine"
arrUnit(10) = "Ten"
arrUnit(11) = "Eleven"
arrUnit(12) = "Twelve"
arrUnit(13) = "Thirteen"
arrUnit(14) = "Fourteen"
arrUnit(15) = "Fifteen"
arrUnit(16) = "Sixteen"
arrUnit(17) = "Seventeen"
arrUnit(18) = "Eighteen"
arrUnit(19) = "Nineteen"

arrTens(0) = ""
arrTens(1) = "Twenty"
arrTens(2) = "Thirty"
arrTens(3) = "Forty"
arrTens(4) = "Fifty"
arrTens(5) = "Sixty"
arrTens(6) = "Seventy"
arrTens(7) = "Eighty"
arrTens(8) = "Ninety"

arrHundred(0) = "Hundred"

if number > 0 and number <= 19 then
Number_to_Text = arrUnit(number)
end if

if number >= 20 and number <= 99 then
Number_to_Text = arrTens(mid(number,1,1)-1) & " " &
arrUnit(mid(number,2,1))
end if

if number >= 100 and number <= 999 then
strTemp = arrUnit(mid(number,1,1)) & " " & arrHundred(0)

if mid(number,2,2) = 0 then
Number_to_Text = strTemp' & " and " &
arrUnit(mid(number,3,1))
end if

if mid(number,2,2) >= 1 and mid(number,2,2) <= 19 then
Number_to_Text = strTemp & " and " &
arrUnit(mid(number,2,2))
end if

if mid(number,2,2) >= 20 then
Number_to_Text = strTemp & " and " &
arrTens(mid(number,2,1)-1) & " " & arrUnit(mid(number,3,1))
end if
end if
end function


%>
<%
for a = 0 to 999
response.write(number_to_text (a) & "<br>")
next
%>

Cheers
Ken


Microsoft MVP - Windows Server (IIS)
www.adOpenStatic.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't figure this out. aaronmuslim XSLT 4 March 20th, 2008 11:13 AM
the Figure 1-3 confused me EdwardChou BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 May 12th, 2007 05:48 PM
Chap 2 Figure 2-9 Prda2r3x BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 4 May 1st, 2007 10:39 AM
RS Manager and RS Server on 2 different computers Choose File BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 22nd, 2004 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.