Converts numeric or string expression to a Uinteger or Uinteger<bits>

declare function Cuint ( byval expression as datatype ) as uinteger
declare function Cuint<bits> ( byval expression as datatype ) as uinteger<bits>

Type typename
End Type

result = Cuint( numeric expression )
result = Cuint( string expression )
result = Cuint( user defined type )

A numeric constant expression indicating the size in bits of unsigned integer desired. The values allowed are 8, 16, 32 or 64.
a numeric, string, or pointer expression to cast to a Uinteger or Uinteger<bits> value
any numeric, string, or pointer data type
a user defined type

Return Value:
A Uinteger or Uinteger<bits> containing the converted value.

The Cuint function rounds off the decimal part and returns a Uinteger value, or if a bits value is supplied, an unsigned integer type of the given size.

The function does not check for an overflow; for example, for a 32-bit Uinteger results are undefined for values which are less than 0 or larger than 4 294 967 296.

The name can be explained as 'Convert to Unsigned INTeger'.

If the argument is a string expression, it is converted to numeric by using Valuint or Valulng, depending on the size of the result type.

' Using the CUINT function to convert a numeric value

'Create an UNSIGNED INTEGER variable
Dim numeric_value As UInteger

'Convert a numeric value
numeric_value = CUInt(300.23)

'Print the result = 300
Print numeric_value

Dialect Differences:
Differences from QB:
See also:
Back to Converting Data Types
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki phatcode