Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 25th, 2005, 03:59 AM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Malta.
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default FormatNumber Problem please help

I can't manage to find a way how to format numbers like below:

Original Number: 65000
I want it formatted this way: 65,000

I tried various ways using the FormatNumber function but I can't get exactly what I want. I want to display a comma after the third number from the right. It must be a comma and not a point.

Can anyone please help me

Thanks You
Reply With Quote
  #2 (permalink)  
Old October 25th, 2005, 12:22 PM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello, Ivany!

I guess I know what is going on... I had exactly the same kind of problem sometime ago!! ;)

Have a look at http://p2p.wrox.com/topic.asp?TOPIC_ID=35390 !

Cheers,
fskilnik

Reply With Quote
  #3 (permalink)  
Old October 25th, 2005, 06:31 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;I want to display a comma after the third number from the right


   function alterNum(numVar)
      alterNum = replace(numVar,"000",",000")
   end function

   dim num
   num = "65000"
   response.write alterNum(num)

Wind is your friend
Matt
Reply With Quote
  #4 (permalink)  
Old November 2nd, 2005, 08:12 AM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hello Ivany and mat41,

I created another function, similar to mat41´s, but a bit more general. I hope you find it useful:

function USCurrency(currValue)
 USCurrency=FormatCurrency(FormatNumber((currValue) , 2, -2, -2, -2))
End function

When you have (say) the currValue= 76543,21 (21 is decimal) this function will get 76,543.21 (thousands and decimals separators)

Important: don´t forget to write "LCID = 1033" (for US formats) at the top of the page where this function is defined!

Cheers,
fskilnik




Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FormatNumber Problem please help ivanv Classic ASP Databases 1 October 26th, 2005 08:16 AM



All times are GMT -4. The time now is 05:35 AM.


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