[Libreoffice-bugs] [Bug 122521] New: JOIN() appends the separator
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Mon Jan 7 04:15:04 UTC 2019
https://bugs.documentfoundation.org/show_bug.cgi?id=122521
Bug ID: 122521
Summary: JOIN() appends the separator
Product: LibreOffice
Version: 6.1.3.2 release
Hardware: x86-64 (AMD64)
OS: Windows (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: BASIC
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: bruce.axtens at gmail.com
Description:
JOIN() should use the second parameter as a separator rather than as an element
terminator. Currently, in Calc macros, the JOIN function returns the array as
separator-joined string but with the separator appended. This is a BAD thing.
Steps to Reproduce:
1. Create a macro (in this case called "goofyJoin" and enter the following code
public function goofyJoin(byval R as range) as string
if not isarray(R) then
msgbox "no range selected"
exit function
end if
dim result(ubound(R)) as string
dim c as integer
c = 0
dim v as variant
for each v in R
result(c) = v
c=c+1
next
dim out as string
out = join(result,",")
goofyJoin = out
end function
2. In a spreadsheet, create a range of numbers.
3. In a nearby cell enter the formula =goofyJoin() and give it the previously
defined range and the separator (e.g. ",")
Actual Results:
The range is joined appropriately, but the separator is also appended.
Expected Results:
The range joined with the separator used as a "separator"
Reproducible: Always
User Profile Reset: No
Additional Info:
Currently I handle this with
if right(out,1) = "," then
out = mid(out,1,len(out)-1)
end if
The issue came up when using Calc to build JSON
--
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/20190107/e1572c6b/attachment.html>
More information about the Libreoffice-bugs
mailing list