From 68a8e252d2600cabc694d9c489ec641dbd3c902a Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Fri, 4 Jun 2021 00:18:32 -0300 Subject: tdf#124066 Help for VBA StrConv function 1) LCID codes linked to LibreOffice internal LCID file 2) Examples borrowed from QA tests Change-Id: I1b00a1901f32de0243b518de39abd633ba08eadc Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116684 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- source/auxiliary/sbasic.tree | 1 + source/text/sbasic/shared/special_vba_func.xhp | 51 +++---- source/text/sbasic/shared/strconv.xhp | 179 +++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 29 deletions(-) create mode 100644 source/text/sbasic/shared/strconv.xhp (limited to 'source') diff --git a/source/auxiliary/sbasic.tree b/source/auxiliary/sbasic.tree index 40d7c6bf20..b52b277ee8 100644 --- a/source/auxiliary/sbasic.tree +++ b/source/auxiliary/sbasic.tree @@ -285,6 +285,7 @@ Static keyword Stop Statement StrComp Function + StrConv Function [VBA] Str Function StrReverse Function [VBA] String Function diff --git a/source/text/sbasic/shared/special_vba_func.xhp b/source/text/sbasic/shared/special_vba_func.xhp index 32d98942e3..8a257ee26b 100644 --- a/source/text/sbasic/shared/special_vba_func.xhp +++ b/source/text/sbasic/shared/special_vba_func.xhp @@ -26,23 +26,20 @@ - -
- VBA Functions;Introduction +VBA Functions;Introduction - -Exclusive VBA Functions and Statements +

Exclusive VBA Functions and Statements

%PRODUCTNAME Basic adds this set of functions when VBA support is enabled.
These exclusive VBA functions are enabled when the statement Option VBASupport 1 is placed before the first macro of a %PRODUCTNAME Basic module.
- - VBA Statements - + +VBA Statements +

VBA Statements

@@ -51,20 +48,21 @@
- VBA Functions;Text Functions +VBA Functions;Text Functions -Text functions +

Text functions

+
- - VBA Functions;Financial Functions - -Financial functions + +VBA Functions;Financial Functions + +

Financial functions

@@ -82,9 +80,9 @@
- VBA Functions;Date and Time Functions +VBA Functions;Date and Time Functions -Date and time functions +

Date and time functions

@@ -92,36 +90,31 @@
- VBA Functions;I/O Functions +VBA Functions;I/O Functions -I/O Functions +

I/O Functions

- VBA Functions;Mathematical Functions - VBA Functions;formatting numbers - VBA Functions;partitioning numbers +VBA Functions;Mathematical Functions +VBA Functions;formatting numbers +VBA Functions;partitioning numbers - -Mathematical Functions +

Mathematical Functions

-
- - VBA Functions;Object Properties and Methods +VBA Functions;Object Properties and Methods - -Object Properties and Methods +

Object Properties and Methods

-
diff --git a/source/text/sbasic/shared/strconv.xhp b/source/text/sbasic/shared/strconv.xhp new file mode 100644 index 0000000000..81267e1879 --- /dev/null +++ b/source/text/sbasic/shared/strconv.xhp @@ -0,0 +1,179 @@ + + + + + + StrConv Function [VBA] + /text/sbasic/shared/strconv.xhp + + + + +StrConv function + +
+

StrConv Function

+ Convert a string as specified by a conversion type. +
+ + +StrConv(Text, Conversion, [ LCID ]) + +String + +Text: Any valid string expression. +Conversion: The type of conversion to perform, as defined in the table below. + + + + Conversion + + + Value + + + Description + + + + + vbUpperCase + + + 1 + + + Converts Text characters to uppercase. + + + + + vbLowerCase + + + 2 + + + Converts Text characters lowercase. + + + + + vbProperCase + + + 3 + + + Converts the first letter of every word in Text to uppercase. + + + + + vbWide + + + 4 + + + Converts narrow (half-width) characters in Text to wide (full-width) characters. + + + + + vbNarrow + + + 8 + + + Converts wide (full-width) characters in Text to narrow (half-width) characters. + + + + + vbKatakana + + + 16 + + + Converts Hiragana characters in Text to Katakana characters. + + + + + vbHiragana + + + 32 + + + Converts Katakana characters in Text to Hiragana characters. + + + + + vbUnicode + + + 64 + + + Converts Text characters to Unicode characters using the default code page of the system. + + + + + vbFromUnicode + + + 128 + + + Converts Text characters from Unicode to the default code page of the system. + + +
+LCID Optional. The Locale ID in decimal number. If this parameter is omitted, it assumes the system Locale ID. Refer to the file msi-encodinglist.txt for the available LCID values. + + +Option VBASupport 1 +Option Explicit +Sub Test_StrConv + Print StrConv("abc EFG hij", vbUpperCase) '= "ABC EFG HIJ" + Print StrConv("abc EFG hij", vbLowerCase) ' = "abc efg hij" + Print StrConv("abc EFG hij", vbProperCase) ' = "Abc Efg Hij" vbProperCase)") + + REM Converts narrow (single-byte) characters in string to wide + Print StrConv("ABCDEVB¥ì¥¹¥­¥å©", vbWide) ' = "ABCDEVB¥ì¥¹¥­¥å©" + + REM Converts wide (double-byte) characters in string to narrow (single-byte) characters + Print StrConv("ABCD@$%23'?EG", vbNarrow) ' = "ABCD@$%23'?EG" + + REM Converts Hiragana characters in string to Katakana characters + Print StrConv("かたかな", vbKatakana) ' = "カタカナ" + + REM Converts Katakana characters in string to Hiragana characters + Print StrConv("カタカナ", vbHiragana) '= "かたかな" + + REM Assumes CP-1252 encoding associated with en-US locale used in unit tests. + Dim x() As Byte + x = StrConv("ÉϺ£ÊÐABC", vbFromUnicode) + Print UBound(x) ' 8 characters + Print x(2) ' = 186 + Print StrConv(x, vbUnicode)' = "ÉϺ£ÊÐABC" +End Sub + +
+ +
+ +
-- cgit