<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - JOIN() appends the separator"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=122521">122521</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>JOIN() appends the separator
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>6.1.3.2 release
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>BASIC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bruce.axtens@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>