From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03120104.xhp | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03120104.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03120104.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03120104.xhp b/helpcontent2/source/text/sbasic/shared/03120104.xhp new file mode 100644 index 000000000..b83dc5625 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03120104.xhp @@ -0,0 +1,65 @@ + + + + + + + Val Function + /text/sbasic/shared/03120104.xhp + + + + +
+ + Val function + +

Val Function

+ Use the Val function to convert a string that represents a number into numeric data type. + The string passed to the Val function is locale-independent. This means that commas are interpreted as thousands separators and a dot is used as the decimal separator. +
+ + + Val (Text As String) + + + Double + + Text: String that represents a number. + If only part of the string contains numbers, only the first appropriate characters of the string are converted. If the string does not contain any numbers then Val returns 0. + + + + + Sub ExampleVal + MsgBox Val("123.1") + 1 ' 124.1 + ' Below 123,1 is interpreted as 1231 since "," is the thousands separator + MsgBox Val("123,1") + 1 ' 1232 + ' All numbers are considered until a non-numeric character is reached + MsgBox Val("123.4A") ' 123.4 + ' The example below returns 0 (zero) since the string provided does not start with a number + MsgBox Val("A123.123") ' 0 + End Sub + + +
+ +
+ +
-- cgit v1.2.3