VBS tutorial: function cint function


Cint function

Returns an expression that has been converted toIntegerSubtypeVariant


expressionArgument is any valid expression.


In general, you can write code using subtype conversion functions to show that the results of some operations should be represented as a specific data type rather than the default type. For example, in the case of currency, single precision or double precision operations, useCIntorCLngEnforces integer operations.

CIntThe function is used to transfer data from other data types toIntegerSubtypes are converted to internationally recognized formats. For example, the identification of decimal separators, such as the thousand separator, may depend on the locale of the system.

IfexpressionAn error occurs when the integer subtype is outside the acceptable range.

The following example usesCIntThe function converts a value to integer:

Dim mydouble, myintmydouble = 2345.5678 'mydouble is a double. Myint = cint (mydouble) 'Myint contains 2346.

be careful    CIntdifferFixandIntThe function removes the decimal part of a value and rounds it. When the decimal part is exactly equal to 0.5,CIntAlways round it to the nearest even number. For example, 0.5 is rounded to 0, and 1.5 is rounded to 2

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]