Concatenate list of string

Hi folks,
referring to the upper image, is it possible to reach the green box result with the red box nodes? If not, why? What’s the logic behind?
Thanks in advance

Take a look at this:

2 Likes

Many thanks @viktor_kuzev ! :slight_smile:

@Carlo_Beltracchi I’ve been wondering about that too! String.Join and String.Concat handles lists different than all the other nodes. We are expecting combined lists as default behavior, Maybe somebody in dev. team have an explanation? @Zach_Kron @Racel

With that said, the equivalent node to the code block in the green group is the “+” node, and that behaves as you are expecting:

2 Likes

@Einar_Raknes , thanks for your answer. In my opinion the key is the need of adding an empty string inside the string Concat node…maybe this let you get a sort of “empty slot”.
I think it depends from combinator (or function) logic…

Yes I understand how that works. The empty slot makes the String.Join node header grey and that means that the node has turned into a funcition f(x) with the empty slot as a variable x. The input of List.Map is that function f(x) and a list of x values.

I was just wondering why List.Join and List.Concat are not combining the list input as you would expect from experience with other nodes.

1 Like

Maybe this blog post can give a little help.

@Einar_Raknes @Carlo_Beltracchi

String.Join and String.Concat are based off of the .net class, string. The .net class has several overloads for both Join and Concat.


Depending on what arguments you feed into the nodes, the system makes its best guess as to what you want to happen. The problem is that the UI doesn’t necessarily match what is happening in the backend.

For instance, both the String.Join and String.Concat nodes ask for string[] in the string0 input. This tells the user that you need to put in a list of strings. But, in reality you can put a list of strings, a single string, even a multi-dimensional list of strings. The node will make its best guess as to which method to actually call. For instance, if you feed the node a mix of individual strings and lists, the node will call the method that has a list as the parameter and not the one that uses individual strings. The node will never mix and match the method calls. It is too hard to predict that this is what the user wants. We don’t surface each overload node because there are just too many. We tried to pick the one that we thought users would use the most.

Hope this makes sense :slight_smile:

8 Likes

Very descriptive! Solved my case!

Kudos Racel :smiley:

hi,
do we have a workflow to join any number of words in a list with space as a separator without using string.join (with separator). Because if we do not know number of words so we cannot ++++ string 1,2,3 and join them.

Thanks,
ap