...

View Full Version : thousand separator



ghell
11-19-2003, 08:34 AM
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

glenngv
11-19-2003, 08:58 AM
FormatCurrency(Expression, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigit)


<% =FormatCurrency(31567) %>

Output:
$31,567.00

ghell
11-19-2003, 05:02 PM
and if i dont want a currency, just a separated number?

Boberto
11-19-2003, 06:37 PM
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. :(

Roy Sinclair
11-19-2003, 07:47 PM
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?

ghell
11-22-2003, 03:14 PM
well it didnt make any diference and its set up rite in windows

M@rco
11-23-2003, 05:44 PM
Since you want a plain number and not an amount of money, you need FormatNumber, not FormatCurrency:
FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

If it doesn't work for you then your regional settings (on the *webserver*) are NOT configured correctly.

ghell
11-24-2003, 08:28 PM
ah hah! it took me ages to work out the syntax for it (those []s didnt help)

i just needed like

formatnumber(102040201.48750453,3,false,false,true)

thanks all

M@rco
11-24-2003, 09:44 PM
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 (http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en)! :p

And the square brackets indicate optional arguments. ;)

ghell
11-30-2003, 05:25 PM
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 :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum