Combine 2 Lists of Strings with a separator

Hi!

I want to combine these two lists of strings. The first item of the first list is added at the end of the first item of the second.

How can I add a “.” separator in this case?

Thanks!

1 Like

5 Likes

4 Likes

Thanks @Vikram_Subbaiah, it is really interesting how you use the String.Join with Long Lacing for the separator only before plug it into the List.Combine.

@Einar_Raknes thanks for your approach. I´m really keen on learning more about creating those kind of statements using Code Block.

It is not so difficult. You just put a + (plus sign) between each part you want to join. Strings are quoted with “”.
list a + separator + list b.

Another example:

3 Likes

Great!

@Einar_Raknes is it possible to set the Lacing type (short, long, cross) within the Code Block?

What if in the graph above I wanted the lists to read like this: 1.A, 2.A, 3.A and the second list like: 20.B, 21.B, 22.C

@Pablo_Perez_Valdivia

You need to use Replication guides to change lacing in code blocks:

1 Like

@Pablo_Perez_Valdivia
Yes, like Kulkul says: You have to use replication guides:

3 Likes

@Kulkul, @Einar_Raknes, thanks guys, really valuable stuff. I´ve learnt a lot.

Again, I´m getting closer and closer and then a new question comes up. In the following graph I´ve highlighted in pink the first problem: How can I add the elements of List_B to the end of each subelement of List_A.

The second problem, as you can see, is that I set the Mark parameter values, then I change them, and then I set them again. This sounds a bit weird and I´m wondering if I could get the same results using just one Set.Parameter node (by wise-management the lists).

2 Likes

One possible solution to you second problem @Pablo_Perez_Valdivia

2 Likes

Hi @Vikram_Subbaiah, that works perfect!!!

@Einar_Raknes, I realized that I already had the list of elements upstream (Watch node on the left), so I can Set.Parameter in just one go.

Here the result:

BTW: This is the end part of a larger Definition that identifies the Area a door belongs to and then set the Area Number parameter + integer as the Door Mark (ie 0.03.4 means Door 4 in Area 0.03).

Node party:

Hi, Could you please help me? I tried to follow the solution here, but it doesn’t work…anyone knows why?


I have the two strings lists, I want to combine them with Hyphen in between…

1 Like

@LAURA.ELENA.DIANU
Not sure why, seems to work fine on mine.
are they actually strings?
image

1 Like

If you could fragment it with more CODE BLOCKS to see the error…?’