Converts a string to an integer
Asp:
CInt ()--note that only short integer values must be converted to a range of 32768 and 32767, long Integer Applications CLng ()
If you do not enter a plain numeric string or an empty string, a direct 500 error occurs. So you should check for numeric types before entering.
Copy Code code as follows:
Function jcid (ByVal paravalue)
If (not IsNumeric (Paravalue) or (Trim (paravalue) = "") Then
Jcid=0
Else
Jcid=paravalue
End If
End Function
Convert between types to the desired format:
CStr (): Convert to Character
CDate (): Convert to date
CInt (): Convert to Integer
CLNG (): Convert growth integral type long
CBool (): Convert to Logical Boolean
CByte (): Converted to byte byte
CSng (): Convert to single-precision floating-point number single
CDBL (): Convert to double-precision floating-point number double
CCur (): Convert to currency format currency
Javascript:
parseint ()--converts to an integer. Note: You should check the results with the isNaN function after the conversion, and 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, with an understanding of 8 in the beginning of 0, and 08 is an illegal string.
parseint ("08", 10) returns 8 because 10 is specified.
<ptml xmlns= "http://www.w3.org/1999/xhtml" > <pead> <title> title page </title> <script language= " JavaScript "> var info = new Array (); Create an Array object info[' name ' = ' John '; Sets an item in the array, noting that the index is a string type info[' age ' = ' 26 '; Sets the second item in the array var i=0; for (var n in info)//traversing each item in the array {i++;//To get the number of elements in the array} alert ("Total" +i+ "element"); Display the total number of elements in an array </script> </pead> <body> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]