Re: coverting string to a numeric value

2010-07-22 Thread Scott Brady

By converting a string to a number, do you mean converting the string value
123 to 123, or do you mean converting one hundred twenty-three to 123?

If it's the first, you've got your answer already.  If it's the second, it's
a bit more complex and something that has come up in the past. You can
search the archives or look at cflib.org, because I suspect someone's
already built a function for that.

Scott

On Mon, Jul 19, 2010 at 2:45 PM, fun and learning
funandlrnn...@gmail.comwrote:


 Hi All-

 is there a way I can convert a string to number in coldfusion. I could not
 see any related functions to do this?

 Thanks


-- 
-
Scott Brady
http://www.scottbrady.net/


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


Re: coverting string to a numeric value

2010-07-22 Thread Jeff Gladnick

I think you want the val() function

so val (123) would return 123

val(jeff) would return 0 (all non numerics return 0)

 Hi All-
 
 is there a way I can convert a string to number in coldfusion. I could 
 not see any related functions to do this?
 
 Thanks 


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


Re: coverting string to a numeric value

2010-07-19 Thread Dave Watts

 is there a way I can convert a string to number in coldfusion. I could not 
 see any related functions to do this?

ColdFusion is very loosely typed, so you don't need to convert a
string to a number. Just use it a numeric operation and it gets
treated as a number. Try it, it's fun!

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

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


RE: coverting string to a numeric value

2010-07-19 Thread Robert Harrison

Depending on what you are doing you may want to test the value first to
ensure it's a number.  You can get hard errors in some cases for data type
mismatch... like in queries.


cfif IsNumeric(myvar is true

DO YOUR THING

/cfif 


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged



-Original Message-
From: Dave Watts [mailto:dwa...@figleaf.com] 
Sent: Monday, July 19, 2010 4:57 PM
To: cf-talk
Subject: Re: coverting string to a numeric value


 is there a way I can convert a string to number in coldfusion. I could not
see any related functions to do this?

ColdFusion is very loosely typed, so you don't need to convert a
string to a number. Just use it a numeric operation and it gets
treated as a number. Try it, it's fun!

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.



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


RE: coverting string to a numeric value

2010-07-19 Thread Robert Harrison

WHOOPS ... SYNTAX ERROR

cfif IsNumeric(myvar) is true


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged



-Original Message-
From: Robert Harrison [mailto:rob...@austin-williams.com] 
Sent: Monday, July 19, 2010 5:04 PM
To: cf-talk
Subject: RE: coverting string to a numeric value


Depending on what you are doing you may want to test the value first to
ensure it's a number.  You can get hard errors in some cases for data type
mismatch... like in queries.


cfif IsNumeric(myvar is true

DO YOUR THING

/cfif 


Robert B. Harrison
Director of Interactive Services
Austin  Williams
125 Kennedy Drive, Suite 100 
Hauppauge NY 11788
P : 631.231.6600 Ext. 119 
F : 631.434.7022
http://www.austin-williams.com 

Great advertising can't be either/or.  It must be .

Plug in to our blog: AW Unplugged
http://www.austin-williams.com/unplugged



-Original Message-
From: Dave Watts [mailto:dwa...@figleaf.com] 
Sent: Monday, July 19, 2010 4:57 PM
To: cf-talk
Subject: Re: coverting string to a numeric value


 is there a way I can convert a string to number in coldfusion. I could not
see any related functions to do this?

ColdFusion is very loosely typed, so you don't need to convert a
string to a number. Just use it a numeric operation and it gets
treated as a number. Try it, it's fun!

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.





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


Re: coverting string to a numeric value

2010-07-19 Thread Michael Grant

Or the short way

cfif isNumeric(myvar)/cfif



On Mon, Jul 19, 2010 at 5:05 PM, Robert Harrison rob...@austin-williams.com
 wrote:


 WHOOPS ... SYNTAX ERROR

 cfif IsNumeric(myvar) is true


 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged



 -Original Message-
 From: Robert Harrison [mailto:rob...@austin-williams.com]
 Sent: Monday, July 19, 2010 5:04 PM
 To: cf-talk
 Subject: RE: coverting string to a numeric value


 Depending on what you are doing you may want to test the value first to
 ensure it's a number.  You can get hard errors in some cases for data type
 mismatch... like in queries.


 cfif IsNumeric(myvar is true

DO YOUR THING

 /cfif


 Robert B. Harrison
 Director of Interactive Services
 Austin  Williams
 125 Kennedy Drive, Suite 100
 Hauppauge NY 11788
 P : 631.231.6600 Ext. 119
 F : 631.434.7022
 http://www.austin-williams.com

 Great advertising can't be either/or.  It must be .

 Plug in to our blog: AW Unplugged
 http://www.austin-williams.com/unplugged



 -Original Message-
 From: Dave Watts [mailto:dwa...@figleaf.com]
 Sent: Monday, July 19, 2010 4:57 PM
 To: cf-talk
 Subject: Re: coverting string to a numeric value


  is there a way I can convert a string to number in coldfusion. I could
 not
 see any related functions to do this?

 ColdFusion is very loosely typed, so you don't need to convert a
 string to a number. Just use it a numeric operation and it gets
 treated as a number. Try it, it's fun!

 Dave Watts, CTO, Fig Leaf Software
 http://www.figleaf.com/
 http://training.figleaf.com/

 Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
 GSA Schedule, and provides the highest caliber vendor-authorized
 instruction at our training centers, online, or onsite.





 

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