Converts a string to an integer.
ASP:
CINT () -- note that only the range of short integer values can be converted must be between-32768 and 32767, and clng () is applied to long integers ()
If the input is not a pure numeric string or a null string, the error 500 is returned. Therefore, check whether the input is Numeric.
CopyCode The Code is as follows: function jcid (byval paravalue)
If (not isnumeric (paravalue) or (TRIM (paravalue) = "") then
Jcid = 0
Else
Jcid = paravalue
End if
End Function
Convert each type to a required format:
CSTR (): Convert to character
Cdate (): Convert to date
CINT (): converts to an integer.
Clng (): converts a long integer
Cbool (): Convert to logical Boolean
Cbyte (): Convert to byte
Csng (): converts a single-precision floating point number single
Cdbl (): Convert to double-precision floating-point double
Ccur (): Convert to currency format currency
Javascript:
Parseint () -- convert to an integer. Note: After conversion, use the isnan function to check the result. If the input is not a pure numeric string, the result is Nan.
Parseint ("ABC") // return Nan.
Parseint ("12abc") // return 12.
Note: parseint ("08") returns 0. If the value starting with 0 is interpreted as octal, 08 is an invalid string.
Parseint ("08", 10) returns 8 because a decimal system is specified.
<textarea id="runcode87342"></textarea> Xmlns = "http://www.w3.org/1999/xhtml">