Returns a number that the beginning of a string can be converted to. Returns 0 if conversion is not possible.
See also IsNumeric.
Val(string)
Any string.
<!--- This example shows Val ---> <HTML> <HEAD> <TITLE> Val Example </TITLE> </HEAD> <BODY bgcolor=silver> <H3>Val Example</H3> <CFIF IsDefined("FORM.theTestValue")> <CFIF Val(FORM.theTestValue) is not 0> <H3>The string <CFOUTPUT>#FORM.theTestValue#</CFOUTPUT> can be converted to a number: <CFOUTPUT>#Val(FORM.theTestValue)#</CFOUTPUT></H3> <CFELSE> <H3>The beginning of the string <CFOUTPUT>#FORM.theTestValue# </CFOUTPUT> cannot be converted to a number</H3> </CFIF> </CFIF> <FORM ACTION="val.cfm" METHOD="POST"> <P>Enter a string, and discover if its beginning can be evaluated to a numeric value. <P><INPUT TYPE="Text" NAME="TheTestValue" VALUE="123Boy"> <INPUT TYPE="Submit" VALUE="Is the beginning numeric?" NAME=""> </FORM> </BODY> </HTML>