Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Type Conversion

Status
Not open for further replies.

AAshcroft

Programmer
Joined
Oct 28, 2001
Messages
5
Location
CA
A simple question from a beginner:

How does one convert a CF integer to a string (and vice-versa)?

 
There's no need to change a data type.

[COLOR=666666]<!--- 10 --->[/color]
<cfset vNum = 1 + 9>
<cfset vNum = &quot;1&quot; + 9>
<cfset vNum = 1 + &quot;9&quot;>
<cfset vNum = &quot;1&quot; + &quot;9&quot;>

[COLOR=666666]<!--- 19 --->[/color]
<cfset vNum = 1 & 9>
<cfset vNum = &quot;1&quot; & 9>
<cfset vNum = 1 & &quot;9&quot;>
<cfset vNum = &quot;1&quot; & &quot;9&quot;>

If you need to change an actual non-digit string to a number (which really would be 0) then use the val() function.
[COLOR=666666]<!--- 9 --->[/color]
<cfset vNum = Val(&quot;Hello&quot;) + 9>
- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top