Re: Thousand Separator ONLY

2012-06-27 Thread Richard White

Thanks Claude that works perfect, muchos gracious!

> Try this:
> (Note that for the last one you will get 0s at the end of the integer 
> part, this is probably because of an overflow error. If you really 
> have such large numbers, a function that works exclusively on the 
> string will be needed.)
> 
> 
> function thSepar(n)
   
> {
   
> var integerPart = numberFormat(listFirst (n, "."), "___,___");
   
> if(listLen(n, ".") GT 1) return integerPart & "." & listLast(n, ".");
   
> return integerPart;
   
> }
> 
> 
> #thSepar(11)#
> #thSepar(1.1)#
> #thSepar(11.11)#
> #thSepar(1.1)#
> #thSepar(1.)#
 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351736
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-27 Thread Richard White

Hey Jason, yes tried it but it adds a decimal to numbers that were previously 
integers, or with numbers that have 5 decimals for example it rounds it to one 
decimal

>Did you try
>
>numberFormat(myNum, ",9.9")
>
>?
>
>
>On 6/27/2012 1:34 PM, Richard White wrote:
>> 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351735
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Jason Fisher

Did you try

numberFormat(myNum, ",9.9")

?


On 6/27/2012 1:34 PM, Richard White wrote:
> I think i may need to be clearer on what i am trying to achieve:
>
> I have any form of number, they could be integer or floats and with varying 
> decimal places such as:
>
> 11
> 1.1
> 11.11
> 1.1
> 1.
>
> etc
>
> I need to have a function that simply adds the thousand separators and 
> returns exactly how they were, such as:
>
> 11
> 11,111.1
> 11.11
> 1.1
> 111,111,111,111,111,111,111.
>
> i was hoping there was an existing function that would handle this but its 
> looking like i am going to have to develop a custom function that handles 
> this as the number either handles integers OR floats but not both?
>
> thanks
>
>
>
>
>
>> Then try
>>
>> numberFormat(myNum, ",9.9")
>>
>> thanks Jason, although this strips off all the decimals
>>
>>> numberFormat(myNum, ",9")
>>>
>>> thanks for your help Robert although that didnt work as it returns lots of
>>> zeros after the decimal place.
>>>
>>> for example: 112221.111 got changed to 112,221.111000
>>>
>>> thanks
>>>
>>> com/austin_
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351731
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Claude Schnéegans

Try this:
(Note that for the last one you will get 0s at the end of the integer part, 
this is probably because of an overflow error. If you really have such large 
numbers, a function that works exclusively on the string will be needed.)


function thSepar(n)
   {
   var integerPart = numberFormat(listFirst (n, "."), "___,___");
   if(listLen(n, ".") GT 1) return integerPart & "." & listLast(n, ".");
   return integerPart;
   }


#thSepar(11)#
#thSepar(1.1)#
#thSepar(11.11)#
#thSepar(1.1)#
#thSepar(1.)#


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351730
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Richard White

I think i may need to be clearer on what i am trying to achieve:

I have any form of number, they could be integer or floats and with varying 
decimal places such as:

11
1.1
11.11
1.1
1.

etc

I need to have a function that simply adds the thousand separators and returns 
exactly how they were, such as:

11
11,111.1
11.11
1.1
111,111,111,111,111,111,111.

i was hoping there was an existing function that would handle this but its 
looking like i am going to have to develop a custom function that handles this 
as the number either handles integers OR floats but not both?

thanks 





>Then try
>
>numberFormat(myNum, ",9.9")
>
>thanks Jason, although this strips off all the decimals
>
>>numberFormat(myNum, ",9")
>>
>>thanks for your help Robert although that didnt work as it returns lots of 
>
>>zeros after the decimal place. 
>>
>>for example: 112221.111 got changed to 112,221.111000
>>
>>thanks
>>
>>com/austin_ 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351728
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Jason Fisher

Then try

numberFormat(myNum, ",9.9")



From: "Richard White" 
Sent: Tuesday, June 26, 2012 1:15 PM
To: "cf-talk" 
Subject: Re: Thousand Separator ONLY

thanks Jason, although this strips off all the decimals

>numberFormat(myNum, ",9")
>
>thanks for your help Robert although that didnt work as it returns lots of 

>zeros after the decimal place. 
>
>for example: 112221.111 got changed to 112,221.111000
>
>thanks
>
>com/austin_ 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351727
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Richard White

thanks Chris, i get an error when using the regular expression that says the 
number 112221.111 cannot be converted to a number

this looks to be an interesting challenge for all of us! :)


> >Kinda thought that's what the DecimalFormat function was all about.
> 
> But now I am reminded that the DecimalFormat function always returns 
> the two decimal places, in addition to the thousands separators. So, I 
> would just run that result through a REReplace and be done with it:
> 
>  ""))>
> 
> -Chris 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351726
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Richard White

thanks Jason, although this strips off all the decimals

>numberFormat(myNum, ",9")
>
>thanks for your help Robert although that didnt work as it returns lots of 
>zeros after the decimal place. 
>
>for example: 112221.111 got changed to 112,221.111000
>
>thanks
>
>com/austin_ 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351725
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Jason Fisher

numberFormat(myNum, ",9")



From: "Richard White" 
Sent: Tuesday, June 26, 2012 12:59 PM
To: "cf-talk" 
Subject: Re: Thousand Separator ONLY

thanks for your help Robert although that didnt work as it returns lots of 
zeros after the decimal place. 

for example: 112221.111 got changed to 112,221.111000

thanks

> I believe you do your own format mask?  I don't know the length of 
> your number, but I think NumberFormat(myvar,"__,___.
> __") would work to cover most any number you throw at it. 
> 
> 
> Robert Harrison 
> Director of Interactive Services
> 
> Austin & Williams
> Advertising I Branding I Digital I Direct  
> 125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
> T 631.231.6600 X 119   F 631.434.7022   
> http://www.austin-williams.com
> 
> Blog:  http://www.austin-williams.com/blog
> Twitter:  http://www.twitter.
com/austin_



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351724
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Christopher Watson

>Kinda thought that's what the DecimalFormat function was all about.

But now I am reminded that the DecimalFormat function always returns the two 
decimal places, in addition to the thousands separators. So, I would just run 
that result through a REReplace and be done with it:



-Chris 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351723
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Richard White

thanks for your help Robert although that didnt work as it returns lots of 
zeros after the decimal place. 

for example: 112221.111 got changed to 112,221.111000

thanks


> I believe you do your own format mask?  I don't know the length of 
> your number, but I think NumberFormat(myvar,"__,___.
> __") would work to cover most any number you throw at it. 
> 
> 
> Robert Harrison 
> Director of Interactive Services
> 
> Austin & Williams
> Advertising I Branding I Digital I Direct  
> 125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
> T 631.231.6600 X 119   F 631.434.7022   
> http://www.austin-williams.com
> 
> Blog:  http://www.austin-williams.com/blog
> Twitter:  http://www.twitter.
com/austin_


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351722
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Christopher Watson

Kinda thought that's what the DecimalFormat function was all about.

-Chris

> Hi, 
> 
> is there any way to take any integer or float and add thousand 
> separators without having to specify or change the decimal places
> 
> thanks 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351721
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Thousand Separator ONLY

2012-06-26 Thread Robert Harrison

I believe you do your own format mask?  I don't know the length of your number, 
but I think NumberFormat(myvar,"__,___.__") would work to 
cover most any number you throw at it. 

Robert Harrison 
Director of Interactive Services

Austin & Williams
Advertising I Branding I Digital I Direct  
125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
T 631.231.6600 X 119   F 631.434.7022   
http://www.austin-williams.com

Blog:  http://www.austin-williams.com/blog
Twitter:  http://www.twitter.com/austin_

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351720
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Thousand Separator ONLY

2012-06-26 Thread Richard White

I haven't been able to spot anything in the mask that does that. If i do not 
specify the decimal places then it returns an integer, whereas i need it to 
pass back the exact same value (whether it was an integer or float) but with 
thousand separators included

thanks

> Should be able to do that with a number format mask http://livedocs.
> adobe.com/coldfusion/8/htmldocs/help.html?content=functions_m-r_08.
> html 
> 
> Robert Harrison 
> Director of Interactive Services
> 
> Austin & Williams
> Advertising I Branding I Digital I Direct  
> 125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
> T 631.231.6600 X 119   F 631.434.7022   
> http://www.austin-williams.com
> 
> Blog:  http://www.austin-williams.com/blog
> Twitter:  http://www.twitter.com/austin_williams 
> 
> 
> -Original Message-
> From: Richard White [mailto:rich...@re-base.net] 
> Sent: Wednesday, June 27, 2012 12:21 PM
> To: cf-talk
> Subject: Thousand Separator ONLY
> 
> 
> Hi, 
> 
> is there any way to take any integer or float and add thousand 
> separators without having to specify or change the decimal places
> 
> thanks 
> 
> 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351718
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Thousand Separator ONLY

2012-06-26 Thread Robert Harrison

Should be able to do that with a number format mask 
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_m-r_08.html
 

Robert Harrison 
Director of Interactive Services

Austin & Williams
Advertising I Branding I Digital I Direct  
125 Kennedy Drive,  Suite 100   I  Hauppauge, NY 11788
T 631.231.6600 X 119   F 631.434.7022   
http://www.austin-williams.com

Blog:  http://www.austin-williams.com/blog
Twitter:  http://www.twitter.com/austin_williams 


-Original Message-
From: Richard White [mailto:rich...@re-base.net] 
Sent: Wednesday, June 27, 2012 12:21 PM
To: cf-talk
Subject: Thousand Separator ONLY


Hi, 

is there any way to take any integer or float and add thousand separators 
without having to specify or change the decimal places

thanks 




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351717
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Thousand Separator ONLY

2012-06-26 Thread Richard White

Hi, 

is there any way to take any integer or float and add thousand separators 
without having to specify or change the decimal places

thanks 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351716
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm