Trim whitespace for each element in an array

Hi

I am trying to trim each element in an array and then use the new array with the trimmed elements. I can’t seem to find a way of doing this, I started with an array iterator but I’m not sure how to push each value to a new array. I’m wondering if there’s a way to do it with map/other array tools so I don’t have to use as many operations? All suggestions please welcome!

The easier way to do this is to iterate over the array, have a Set Variable Module where you can perform trim(value) of the value that you get from the iterator and after which you can use an aggregator to collect the variable.

And, To use the resultant array you then need to use,

{{map(4.array; "variableName")}}

to get the output array. I will see if there is a better way to do this, or maybe other members have better solution for this.

1 Like

Thank you! Have got this working thanks to your advice, it uses so many operations as they are large arrays so that’s a bit annoying but so happy to have it working. I wish there was some sort of for each function or an array trim function!

1 Like