Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts

    thousand separator

    im looking to change a number into a number with thousand separators eg.
    48243832 into 48,243,832

    is there any way of doing this? i thought thats waht groupdigit in formatnumber was but, it didnt seem to make any difference

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    FormatCurrency(Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigit)


    <% =FormatCurrency(31567) %>

    Output:
    $31,567.00
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    and if i dont want a currency, just a separated number?

  • #4
    New Coder
    Join Date
    Nov 2003
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe <% FormatNumber (31567) %> would work. I haven't used that myself. I had to look it up.

    Edit, sorry. I just read the bottom part of your post.
    A wise man can see more from the bottom of a well than a fool can see from the top of a mountain.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i thought thats waht groupdigit in formatnumber was but, it didnt seem to make any difference
    That's exactly what it's for, have you checked the Control Panel to make sure it's set up (Look under the "Regional Settings" applet). What value did you use for the GroupDigits parameter?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #6
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    well it didnt make any diference and its set up rite in windows

  • #7
    Regular Coder
    Join Date
    Oct 2003
    Location
    London, UK
    Posts
    411
    Thanks
    0
    Thanked 1 Time in 1 Post
    Since you want a plain number and not an amount of money, you need FormatNumber, not FormatCurrency:
    Code:
    FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])
    If it doesn't work for you then your regional settings (on the *webserver*) are NOT configured correctly.
    Marcus Tucker / www / blog
    Web Analyst Programmer / Voted SPF "ASP Guru"

  • #8
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    ah hah! it took me ages to work out the syntax for it (those []s didnt help)

    i just needed like
    Code:
    formatnumber(102040201.48750453,3,false,false,true)
    thanks all

  • #9
    Regular Coder
    Join Date
    Oct 2003
    Location
    London, UK
    Posts
    411
    Thanks
    0
    Thanked 1 Time in 1 Post
    Originally posted by ghell
    ah hah! it took me ages to work out the syntax for it (those []s didnt help)
    Why? It's fully documented in your VBScript documentation!

    And the square brackets indicate optional arguments.
    Marcus Tucker / www / blog
    Web Analyst Programmer / Voted SPF "ASP Guru"

  • #10
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    dont patronise me ¬_¬

    thanks for docs link.. i didnt actualy know there was any VB script documentation, and i knew []s were optional but when im trying to work out how it works it just makes me wonder if i need any of them, so i try it... like if it says function([option1],[option2],[date]).... i know that you can use data without calling the server date by putting brakets around it, so it can be confusing with bools etc.... shutup.. i know im stupid.. but...arses to you


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •