[Libreoffice-bugs] [Bug 124066] New: : Basic: missing Help for functions Replace and StrConv

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed Mar 13 22:31:57 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=124066

            Bug ID: 124066
           Summary: : Basic: missing Help for functions Replace and
                    StrConv
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: Documentation
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: gerhard.weydt at t-online.de
                CC: olivier.hallot at documentfoundation.org

For two functions available in Basic, namely Replace and StrConv, there is no
help. These functions (as far as I understand, they were modelled upon
eponymous functions in VBA) were introduced into OpenOffice.org and obviously
also into LibreOffice (see https://bz.apache.org/ooo/show_bug.cgi?id=100953) as
tentative, but they are still active, and at least the first one seems to be
working completely. So, as some people already suggested, there should be a
description in the help files, for they supply helpful functionality which
would otherwise have to be programmed.
I supply descriptions that I hope can be used for the help files. In the first
case I think it is complete, in the second case I provide a text which only
covers the cases I could test, and a separate description of the rest where I
am not sure what is happening.
For the second case, the function StrConv, there are could not get a convincing
result regarding conversion from/to Unicode; hence I propose a text which may
well be adjusted .
Especially, I am not sure whether a help text for StrConv should be published,
as some functionality could not be verified by me, and the third parameter
seems to be still irrelevant. Andrew Pitonyak provided some information in his
OOME book, which could not be confirmed in the case of Unicode conversion, a
situation which may well be outdated.


Replace Function
Replaces some string by another.

Syntax:
Replace (Text As String, SearchStr As String, ReplStr As String [, Start As
Long [, Count as long [, Compare As Boolean]]]

Return Value:
String

Parameters:
Text: Any string expression that you want to modify.
SearchStr: Any string expression that shall be searched for.
ReplStr: Any string expression that shall replace the found search string.
Start: Numeric expression that indicates the character position within the
string where the search shall begin. The maximum allowed value is 65535.
Count: The maximal number of times the replace shall be performed.
Compare: Optional numeric expression that defines the type of comparison. The
value of this parameter can be 0 or 1. The default value of 1 specifies a text
comparison that is not case-sensitive. The value of 0 specifies a binary
comparison that is case-sensitive. You can as well use FALSE instead of 0 or
TRUE instead of 1.

Error codes:
5 Invalid procedure call

Example:

msgbox replace ("aBbcnnbnn", "b", "$", 1, 1, FALSE)     'returns "aB$cnnbnn"
meaning: "b" should be replaced, but
    • only when lowercase (parameter 6), hence second occurrence of "b"
    • only first (respecting case) occurrence (parameter 5)


StrConvFunction
Converts a string according to the parameters supplied.

Syntax:
StrConv (Text As String, Mode As Long[, locale_id As Long ])

Return Value:
String

Parameters:
Text: Any string expression that you want to modify.
Mode: An integer (Long) value describing the type of conversion you want to be
done:
0       No change.
1       Convert all characters to uppercase.
2       Convert all characters to lowercase.
3       Convert first characters of each word to uppercase.
4       Convert narrow (half-width) characters in the string to wide
(full-width) characters.
8       Convert wide (full-width) characters in the string to narrow
(half-width) characters.
16      Convert Hiragana characters in the string to Katakana characters.
32      Convert Katakana characters in the string to Hiragana characters.
Modes 4 and 8 are mainly applicable to Far East character sets; Modes 16 and 32
are used for Japanese character sets

Error codes:
5 Invalid procedure call

Example:

msgbox StrConv("abb jkk",3)     'returns "Abb Jkk"


Additional information for StrConv, to be added in some form to the above help
only if found to be correct:
The description for the following values of parameter “mode” as found in Andrew
Pitonyak’s OOME is not very clear: 
64      Convert all characters to Unicode.
128     Convert all characters from Unicode.
The following explanation is derived from Microsoft’s function:
64      Converts the string to Unicode using the default code page of the
system.
128     Converts the string from Unicode to the default code page of the
system.
The output of a call with mode 128 is for my system an array of bytes, and
according to information found somewhere in the Microsoft files, it should be
an array of multiple bytes for other codepages, e.g. asian ones. Such an array
can be used as input for a call with mode 64. It seems to me that the
description derived from the Microsoft function applies to the LibreOffice
function, but then I could only test it with the codepage used in Germany
(which is probably 1252). I am not able to test these modes in other
situations.
One reason not to mention the modes 64 and 128 might also be that there may
possibly not much need now for them, as Unicode is prevalent.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190313/0b152425/attachment-0001.html>


More information about the Libreoffice-bugs mailing list