[Libreoffice-bugs] [Bug 121325] New: 4-argument form of Mid() BASIC function broken in 6.x (worked in 4.x and OO)

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Nov 10 02:26:00 UTC 2018


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

            Bug ID: 121325
           Summary: 4-argument form of Mid() BASIC function broken in 6.x
                    (worked in 4.x and OO)
           Product: LibreOffice
           Version: 6.1.3.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: jim.avera at gmail.com

Description:
The 4-argument form of the BASIC instruction Mid(str,start,len,repl) is
supposed to replace the selected sub-string with the specified replacement
text.  However starting with 6.1 it produces the wrong result if the
replacement text is shorter than the selected text: the extra characters are
not deleted.

Note: The documentation says that the replacement text will be truncated if it
is *longer* than the specified substring.  However it is allowed to be shorter,
in which case the extra character(s) should be deleted.

Documentation is at
 
https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Strings_(Runtime_Library)
  [search for "replaces three"]

I will attach a spreadsheet with a small macro which demonstrates the bug.

Steps to Reproduce:
1. Open attached "MidBugDemo.ods" spreadsheet
2. Enable macros & run the macro at <filename>->Standard->Module1->BugDemo
(detailed instructions are in the spreadsheet)

Actual Results:
MyString = "This was my text"
Mid(MyString, 6, 3, "is")
RESULT IS "This iss my text" (wrong)


Expected Results:
Should get "This is my text"


Reproducible: Always


User Profile Reset: No



Additional Info:

-- 
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/20181110/d02c18d2/attachment-0001.html>


More information about the Libreoffice-bugs mailing list