Combine Consecutive Strings with same start

I have a list of strings and I want to combine consecutive strings that begin with a specific string. I’m at home right know so I can’t really show an example from Dynamo. I will update this later.

Here is what I have.

1,
2,
3,
[START]a,
[START]b,
4,
5,
6,
[START]c,
[START]d,
[START]e,
[START]f,
7,
8

This is what I would like the result to be:

1,
2,
3,
[START]a[START]b,
4,
5,
6,
[START]c[START]d[START]e[START]f,
7,
8

I can find the easily find string starting with the specific string. I’m just having issues combine them together in that way.

Hi @crapai,

Something like this?

3 Likes

use list.chop, then combine the string using leveling. that should do the trick

Thanks bsalvio this was highly useful for me in solving another problem identifying breaks in sun hours! Definitely the or a solution for sure

Hi @GavC,

No problem, just giving back to the community.

-biboy

1 Like

Thanks for the help. It’s not working for me however. I had to remove the ‘str’ on line 17 because I’m only working with strings and it was giving me this error: unknown’, ‘\x00’, 0, 1, ‘’

No it seems to be doing nothing.

I’ve managed to do this by doing the following. Thanks for the help.