From f3b76b5e8d644176704c4619304278869ae57127 Mon Sep 17 00:00:00 2001 From: Alain Romedenne Date: Mon, 4 Apr 2022 16:46:25 +0100 Subject: tdf#141474 Cdbl, Cint, Clng, Csng accept keyword arguments - expression argument uses english number notation - numbers are rendered according to LibO language settings Change-Id: I2d988e4d151223ea3fa4a3622300bbeab567a1fe Reviewed-on: https://gerrit.libreoffice.org/c/help/+/132389 Tested-by: Jenkins Reviewed-by: Rafael Lima --- source/text/sbasic/shared/03100400.xhp | 26 ++++++++-------------- source/text/sbasic/shared/03100500.xhp | 15 +++++++------ source/text/sbasic/shared/03100600.xhp | 16 ++++++++------ source/text/sbasic/shared/03100900.xhp | 40 ++++++++++++++++++++-------------- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/source/text/sbasic/shared/03100400.xhp b/source/text/sbasic/shared/03100400.xhp index 98a7b4aa05..9546166c63 100644 --- a/source/text/sbasic/shared/03100400.xhp +++ b/source/text/sbasic/shared/03100400.xhp @@ -32,33 +32,25 @@ CDbl function -CDbl Function +

CDbl Function

Converts any numerical expression or string expression to a double type. -Syntax + -CDbl (Expression) +CDbl (Expression As Variant) As Double -Return value + Double -Parameters: - Expression: Any string or numeric expression that you want to convert. To convert a string expression, the number must be entered as normal text ("123.5") using the default number format of your operating system. + + -
-Example: - -Sub ExampleCountryConvert - MsgBox CDbl(1234.5678) - MsgBox CInt(1234.5678) - MsgBox CLng(1234.5678) -End Sub - -
- + + + diff --git a/source/text/sbasic/shared/03100500.xhp b/source/text/sbasic/shared/03100500.xhp index 0bb3a341ae..9dda185122 100644 --- a/source/text/sbasic/shared/03100500.xhp +++ b/source/text/sbasic/shared/03100500.xhp @@ -36,17 +36,16 @@ Converts any string or numeric expression to an integer. -

Syntax:

+ -CInt (Expression) +CInt (Expression As Variant) As Integer -

Return value:

+ Integer -

Parameters:

- Expression: Any expression that you want to convert. -If the argument is a number, it is used as numeric value of the expression. + + 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: @@ -65,6 +64,8 @@ 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, $[officename] Basic reports an overflow error. Otherwise, the result is returned. - + + + diff --git a/source/text/sbasic/shared/03100600.xhp b/source/text/sbasic/shared/03100600.xhp index 6466bc13eb..52e43f16cf 100644 --- a/source/text/sbasic/shared/03100600.xhp +++ b/source/text/sbasic/shared/03100600.xhp @@ -32,25 +32,27 @@ CLng function -CLng Function +

CLng Function

Converts any string or numeric expression to a long integer. -Syntax: + -CLng (Expression) +CLng (Expression As Variant) As Long -Return value: + Long -Parameters: - Expression: Any numerical expression that you want to convert. If the Expression lies outside the valid long integer range between -2.147.483.648 and 2.147.483.647, $[officename] Basic returns an overflow error. To convert a string expression, the number must be entered as normal text ("123.5") using the default number format of your operating system. + + +If Expression lies outside the valid long integer range between -2.147.483.648 and 2.147.483.647, $[officename] Basic returns an overflow error. This function always rounds the fractional part of a number to the nearest integer. - + + diff --git a/source/text/sbasic/shared/03100900.xhp b/source/text/sbasic/shared/03100900.xhp index 175533eca9..649768f0e7 100644 --- a/source/text/sbasic/shared/03100900.xhp +++ b/source/text/sbasic/shared/03100900.xhp @@ -27,39 +27,47 @@ -
CSng function - -CSng Function +

CSng Function

Converts any string or numeric expression to data type Single.
-Syntax: + -CSng (Expression) +CSng (Expression As Variant) As Single -Return value: + Single -Parameters: - Expression: Any string or numeric expression that you want to convert. To convert a string expression, the number must be entered as normal text ("123.5") using the default number format of your operating system. + +
+ Expression: Any string or numeric expression that you want to convert. To convert a string expression, the number must be entered using a dot "." as the decimal point and a comma "," as the thousands separator (for instance 123,456.78), which may differ from your %PRODUCTNAME language settings. +
-Example: + +
+Numeric expressions are displayed according %PRODUCTNAME language settings: -Sub ExampleCSNG - MsgBox CDbl(1234.5678) - MsgBox CInt(1234.5678) - MsgBox CLng(1234.5678) - MsgBox CSng(1234.5678) -End Sub +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 - +
+ \ No newline at end of file -- cgit