CInt Function

Tips >>ASP Functions


WANTS TO MAKE SOFTWARE WITHOUT KNOWLEDGE OF ASP? CLICK HERE

The CInt function converts an expression to type Integer. Its parameter is expression which describes any valid expression. The cInt function raises an exception when passed a null value, blank string, or non-numerical string. You can adapt the function to cInt2 to handle these values and use it in the same manner. If you pass the cInt function a null value, blank string, or non-numerical string it raises an exception. In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CInt or CLng to force integer arithmetic in cases where currency, single-precision, or double-precision arithmetic normally would occur.Use the CInt function to provide internationally aware conversions from any other data type to an Integer subtype.
Note :- The value must be a number between -32768 and 32767.

The Syntax of CInt Function is :-

CInt(expression)

Example#1 :-

Code :-
dim a
a=134.345
document.write(CInt(a))
Output :-
134

Example#2 :-

Code :-
dim a
a= -30000.24
document.write(CInt(a))
Output :-
30000


Note :-CInt differs from the Fix and Int functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the CInt function always rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.

 

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

+91-9967648641

+91-9967648641