Bug 122352 - Mid statement ignores length parameter
Summary: Mid statement ignores length parameter
Status: RESOLVED DUPLICATE of bug 121325
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.1.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-28 01:04 UTC by Klaus Blum
Modified: 2018-12-28 11:03 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Blum 2018-12-28 01:04:43 UTC
Description:
The Mid statement can be used to replace a sub-string inside a given string. 
The third parameter specifies the number of characters to be replaced. 
This parameter is ignored.

See following snippet:

Sub StringTest
	Dim MyString As String
	MyString = "This will be my text"
	Mid(MyString, 6, 7, "is")
End Sub

In the string "This will be my text", we should see that starting at the 6th position 7 characters are replaced by "is". 


Steps to Reproduce:
Open the given snippet in the macro debugger and observe the "MyString" variable before and after the "Mid" statement

Actual Results:
Only 2 characters instead of 7 are replaced: 
"This isll be my text"

Expected Results:
7 characters should be replaced by "is": 
"This is my text"


Reproducible: Always


User Profile Reset: Yes



Additional Info:
I cannot exactly tell which version was the first affected. 
I have observed the described problem in LO 6.1.3.2
The problem did not yet exist in LO 6.0.5.2
Comment 1 Oliver Brinzing 2018-12-28 11:03:05 UTC
with lo 6.1.4.2 result is: "This is my text"

*** This bug has been marked as a duplicate of bug 121325 ***