Funci贸n CInt

Convierte cualquier expresi贸n de cadena o num茅rica en un entero.

Sintaxis:


CInt (Expression As Variant) As Integer

Valor de retorno:

Integer

Par谩metros:

Expression: Any string or numeric expression that you want to convert. To convert a string expression, the number must be entered as normal text using the default number format of your LibreOffice locale settings. For instance, the number must be entered using a dot "." as the decimal point and a comma "," as the thousands separator (for instance 123,456.78) for the English locale setting.

If the argument is string, the function trims the leading white space; then it tries to recognize a number in following characters. The syntax below are recognized:

Se ignora el resto de la cadena. Si la cadena no se reconoce, p. ej., cuando despu茅s de retirar el espacio en blanco al principio no empieza por 芦+禄, 芦鈭捖, una cifra decimal o 芦&禄, o bien, cuando la secuencia despu茅s de 芦&O禄 supera los 11 caracteres o contiene un car谩cter alfab茅tico, el valor num茅rico de la expresi贸n ser谩 de 0.

Si el argumento es un error, se utilizar谩 el n煤mero del error como valor num茅rico de la expresi贸n.

If the argument is a date, number of days since 1899-12-30 (serial date) is used as numeric value of the expression. Time is represented as fraction of a day.

After calculating the numeric value of the expression, it is rounded to the nearest integer (if needed), and if the result is not between -32768 and 32767, LibreOffice Basic reports an overflow error. Otherwise, the result is returned.

C贸digos de error:

5 Llamada a procedimiento no v谩lida

Ejemplo:

Numeric expressions are displayed according to LibreOffice locale settings:


Sub ExampleCountryConvert
    MsgBox CDbl(1234.5678) ' 1234.5678
    MsgBox CInt(1234.5678) ' 1235
    MsgBox CLng(1234+5678) ' 6912
    MsgBox CSng(1234.5678) ' 1234.567749023

    MsgBox CDbl(expression := 5678.1234) ' 5678.1234
    MsgBox CInt(expression := 5678.1234) ' 5678
    MsgBox CLng(expression := 5678+1234) ' 6912
    MsgBox CSng(expression := 5678.1234) ' 5678.123535156
End Sub

隆Necesitamos su ayuda!