diff options
author | Alain Romedenne <alain.romedenne@libreoffice.org> | 2022-04-04 16:46:25 +0100 |
---|---|---|
committer | Alain Romedenne <alain.romedenne@libreoffice.org> | 2022-05-19 16:22:15 +0200 |
commit | f3b76b5e8d644176704c4619304278869ae57127 (patch) | |
tree | 7149bd2a249f9cdc91315c43cf2927b6eadc8047 | |
parent | c6813f12e709e0ad6ad727ab0c9205d262fa89fb (diff) |
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 <rafael.palma.lima@gmail.com>
-rw-r--r-- | source/text/sbasic/shared/03100400.xhp | 26 | ||||
-rw-r--r-- | source/text/sbasic/shared/03100500.xhp | 15 | ||||
-rw-r--r-- | source/text/sbasic/shared/03100600.xhp | 16 | ||||
-rw-r--r-- | 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 @@ <bookmark_value>CDbl function</bookmark_value> </bookmark> -<paragraph id="hd_id3153750" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03100400.xhp" name="CDbl Function">CDbl Function</link></paragraph> +<h1 id="hd_id3153750" xml-lang="en-US"><link href="text/sbasic/shared/03100400.xhp" name="CDbl Function">CDbl Function</link></h1> <paragraph id="par_id3149233" role="paragraph" xml-lang="en-US">Converts any numerical expression or string expression to a double type.</paragraph> </section> -<paragraph id="hd_id3149516" role="heading" level="2" xml-lang="en-US">Syntax</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <bascode> -<paragraph id="par_id3156152" role="bascode" xml-lang="en-US">CDbl (Expression)</paragraph> +<paragraph id="par_id3156152" role="bascode" xml-lang="en-US">CDbl (Expression As Variant) As Double</paragraph> </bascode> -<paragraph id="hd_id3153061" role="heading" level="2" xml-lang="en-US">Return value</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> <paragraph id="par_id3145068" localize="false" role="paragraph">Double</paragraph> -<paragraph id="hd_id3154760" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph> -<paragraph id="par_id3153897" role="paragraph" xml-lang="en-US"> <emph>Expression:</emph> 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.</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functparameters"/> +<embed href="text/sbasic/shared/03100900.xhp#ExpressionArgument"/> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> -<section id="examplecountryconvert"> -<paragraph id="hd_id3148797" role="heading" level="2" xml-lang="en-US">Example:</paragraph> -<bascode> -<paragraph id="par_idm1340893312" role="bascode" localize="false" xml-lang="en-US">Sub ExampleCountryConvert</paragraph> -<paragraph id="par_idm1340892064" role="bascode" localize="false" xml-lang="en-US"> MsgBox CDbl(1234.5678)</paragraph> -<paragraph id="par_idm1340890816" role="bascode" localize="false" xml-lang="en-US"> MsgBox CInt(1234.5678)</paragraph> -<paragraph id="par_idm1340889568" role="bascode" localize="false" xml-lang="en-US"> MsgBox CLng(1234.5678)</paragraph> -<paragraph id="par_idm1340888320" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> -</bascode> -</section> -</body> +<embed href="text/sbasic/shared/00000003.xhp#functexample"/> +<embed href="text/sbasic/shared/03100900.xhp#ExampleCountryConvert"/> +</body> </helpdocument> 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 @@ <paragraph id="par_id3155419" role="paragraph" xml-lang="en-US">Converts any string or numeric expression to an integer.</paragraph> </section> -<h2 id="hd_id3147573">Syntax:</h2> +<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <bascode> -<paragraph id="par_id3154142" role="bascode" xml-lang="en-US">CInt (Expression)</paragraph> +<paragraph id="par_id3154142" role="bascode" xml-lang="en-US">CInt (Expression As Variant) As Integer</paragraph> </bascode> -<h2 id="hd_id3147531">Return value:</h2> +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> <paragraph id="par_id3147560" localize="false" role="paragraph">Integer</paragraph> -<h2 id="hd_id3145069">Parameters:</h2> -<paragraph id="par_id3159414" role="paragraph" xml-lang="en-US"> <emph>Expression:</emph> Any expression that you want to convert.</paragraph> -<paragraph id="par_id3159415" role="paragraph" xml-lang="en-US">If the argument is a number, it is used as numeric value of the expression.</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functparameters"/> +<embed href="text/sbasic/shared/03100900.xhp#ExpressionArgument"/> <paragraph id="par_id3159416" role="paragraph" xml-lang="en-US">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:</paragraph> <list type="unordered"> <listitem> @@ -65,6 +64,8 @@ <paragraph id="par_id3150358" role="paragraph" xml-lang="en-US">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.</paragraph> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> -<embed href="text/sbasic/shared/03100400.xhp#examplecountryconvert"/> + +<embed href="text/sbasic/shared/00000003.xhp#functexample"/> +<embed href="text/sbasic/shared/03100900.xhp#ExampleCountryConvert"/> </body> </helpdocument> 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 @@ <bookmark_value>CLng function</bookmark_value> </bookmark> -<paragraph id="hd_id3153311" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03100600.xhp" name="CLng Function">CLng Function</link></paragraph> +<h1 id="hd_id3153311" xml-lang="en-US"><link href="text/sbasic/shared/03100600.xhp" name="CLng Function">CLng Function</link></h1> <paragraph id="par_id3148686" role="paragraph" xml-lang="en-US">Converts any string or numeric expression to a long integer.</paragraph> </section> -<paragraph id="hd_id3145315" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <bascode> -<paragraph id="par_id3147573" role="bascode" xml-lang="en-US">CLng (Expression)</paragraph> +<paragraph id="par_id3147573" role="bascode" xml-lang="en-US">CLng (Expression As Variant) As Long</paragraph> </bascode> -<paragraph id="hd_id3145610" role="heading" level="2" xml-lang="en-US">Return value:</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> <paragraph id="par_id3153897" localize="false" role="paragraph">Long</paragraph> -<paragraph id="hd_id3154760" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph> -<paragraph id="par_id3159414" role="paragraph" xml-lang="en-US"> <emph>Expression:</emph> Any numerical expression that you want to convert. If the <emph>Expression</emph> 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.</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functparameters"/> +<embed href="text/sbasic/shared/031004900.xhp#ExpressionArgument"/> +<paragraph id="par_id3159414" role="paragraph" xml-lang="en-US">If <literal>Expression</literal> lies outside the valid long integer range between -2.147.483.648 and 2.147.483.647, $[officename] Basic returns an overflow error.</paragraph> <paragraph id="par_id3150358" role="paragraph" xml-lang="en-US">This function always rounds the fractional part of a number to the nearest integer.</paragraph> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> -<embed href="text/sbasic/shared/03100400.xhp#examplecountryconvert"/> +<embed href="text/sbasic/shared/00000003.xhp#functexample"/> +<embed href="text/sbasic/shared/03100900.xhp#ExampleCountryConvert"/> </body> </helpdocument> 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 @@ <body> - <section id="csng"> <bookmark xml-lang="en-US" branch="index" id="bm_id3153753"> <bookmark_value>CSng function</bookmark_value> </bookmark> - -<paragraph id="hd_id3153753" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03100900.xhp" name="CSng Function">CSng Function</link></paragraph> +<h1 id="hd_id3153753" xml-lang="en-US"><link href="text/sbasic/shared/03100900.xhp" name="CSng Function">CSng Function</link></h1> <paragraph id="par_id3149748" role="paragraph" xml-lang="en-US">Converts any string or numeric expression to data type Single.</paragraph> </section> -<paragraph id="hd_id3153255" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <bascode> -<paragraph id="par_id3148983" role="bascode" xml-lang="en-US">CSng (Expression)</paragraph> +<paragraph id="par_id3148983" role="bascode" xml-lang="en-US">CSng (Expression As Variant) As Single</paragraph> </bascode> -<paragraph id="hd_id3152347" role="heading" level="2" xml-lang="en-US">Return value:</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> <paragraph id="par_id3153750" localize="false" role="paragraph">Single</paragraph> -<paragraph id="hd_id3146957" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph> -<paragraph id="par_id3153345" role="paragraph" xml-lang="en-US"> <emph>Expression:</emph> 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.</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functparameters"/> +<section id="ExpressionArgument"> +<paragraph id="par_id3153897" role="paragraph" xml-lang="en-US"> <emph>Expression</emph>: 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 <link href="text/shared/optionen/01140000.xhp" name="language settings">language settings</link>.</paragraph> +</section> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> -<paragraph id="hd_id3149514" role="heading" level="2" xml-lang="en-US">Example:</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functexample"/> +<section id="ExampleCountryConvert"> +<paragraph role="paragraph" id="par_id761652451117906">Numeric expressions are displayed according %PRODUCTNAME <link href="text/shared/optionen/01140000.xhp" name="language settings">language settings</link>:</paragraph> <bascode> -<paragraph id="par_idm1341609456" role="bascode" localize="false" xml-lang="en-US">Sub ExampleCSNG</paragraph> -<paragraph id="par_idm1341608224" role="bascode" localize="false" xml-lang="en-US"> MsgBox CDbl(1234.5678)</paragraph> -<paragraph id="par_idm1341606976" role="bascode" localize="false" xml-lang="en-US"> MsgBox CInt(1234.5678)</paragraph> -<paragraph id="par_idm1341605728" role="bascode" localize="false" xml-lang="en-US"> MsgBox CLng(1234.5678)</paragraph> -<paragraph id="par_idm1341604480" role="bascode" localize="false" xml-lang="en-US"> MsgBox CSng(1234.5678)</paragraph> -<paragraph id="par_idm1341603232" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> +<paragraph id="par_idm1341609456" role="bascode" localize="false">Sub ExampleCountryConvert</paragraph> +<paragraph id="par_idm1341608224" role="bascode" xml-lang="en-US"> MsgBox CDbl(1234.5678) ' 1234.5678</paragraph> +<paragraph id="par_idm1341606976" role="bascode" localize="false"> MsgBox CInt(1234.5678) ' 1235</paragraph> +<paragraph id="par_idm1341605728" role="bascode" localize="false"> MsgBox CLng(1234+5678) ' 6912</paragraph> +<paragraph id="par_idm1341604480" role="bascode" xml-lang="en-US"> MsgBox CSng(1234.5678) ' 1234.567749023</paragraph> +<paragraph id="par_idm1341603223" role="bascode" localize="false"></paragraph> +<paragraph id="par_idm1341608242" role="bascode" xml-lang="en-US"> MsgBox CDbl(expression := 5678.1234) ' 5678.1234</paragraph> +<paragraph id="par_idm1341606967" role="bascode" localize="false"> MsgBox CInt(expression := 5678.1234) ' 5678</paragraph> +<paragraph id="par_idm1341605782" role="bascode" localize="false"> MsgBox CLng(expression := 5678+1234) ' 6912</paragraph> +<paragraph id="par_idm1341604408" role="bascode" xml-lang="en-US"> MsgBox CSng(expression := 5678.1234) ' 5678.123535156</paragraph> +<paragraph id="par_idm1314603223" role="bascode" localize="false">End Sub</paragraph> </bascode> -</body> +</section> +</body> </helpdocument>
\ No newline at end of file |