I'm trying to calculate a field by concatenating several other fields. I need to remove extra spaces from the concatenated string. There's a straightforward way to do this in Python:
<SPAN class="string token">" "</SPAN><SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>concatVar<SPAN class="punctuation token">.</SPAN>split<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
I'm trying to do the equivalent thing using Arcade, since attribute rules require it. I've played around with Arcade's split and concatenate and even replace, the latter of which can get the job done but isn't ideal. This seems like the most literal equivalent of the Python function:
<SPAN class="token function">concatenate</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">split</SPAN><SPAN class="punctuation token">(</SPAN>concatVar<SPAN class="punctuation token">,</SPAN><SPAN class="string token">" "</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">" "</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
The split and repeated concatenation is pointless; it still doesn't get rid of the extra spaces. The fundamental problem seems to be that Arcade's split function requires a separator to be specified rather than treating whitespace of any amount as a separator by default like Python.
I've also thought about creating a for loop to trim each variable and/or use IsEmpty to find and remove nulls before they're even added to the concatenated string, but I thought there must be a simpler way. Thanks for any help.