String Manipulation (Variable): Convert to Collection Type List or Set

Hi,

I’d like to propose to convert a string variable, using the String Manipulation (Variable) node, directly to a collection of the type list or set. Here are two examples

Syntax: toCollection("STRING", "DELIMITER", "[List|Set])
Example 1: toCollection("abc|def|def", "|", "List") --> [abc,def,def]
Example 2: toCollection("abc|def|def", "|", "Set") --> [abc,def]

@Vernalis just FYI in case that falls more into your realm of expertise as the de facto collection guru :wink: It might be the counter node to “Collection to String”.

Cheers
Mike

I think you can already do this with the Cell Splitter node:

If I missed a detail, then do let me know!

Steve

1 Like

Yes, I mentioned that but it’s not working for a variable. I will rectify my initial post as the cell splitter can generate set too.

1 Like

Not an answer to your idea (which I like) and I hope the new (future) Expressions node will build on this too

Anyway, on a related subject… I have a component :wink:

Actually, I’ve been toying with a few other components recently in the realm of collections, to make my life a little easier when dealing with collection columns too…

Thinking about it, I should look to write variable versions of those.

And one day I really must get round to finally building real nodes for some of these components… :thinking:

2 Likes

Ah - I should fully read the question!

I’ll think… When we wrote those collection nodes array variables didn’t exist, so operating on them wasn’t really an issue!

(In fact for our ‘Load … files’ series of nodes, we had to create a kludgy way of pretending that string array variables existed. At least, as far as I know, Path[] variables still dont exist - only Path - and so I still haven’t really worked out how to migrate that set of nodes to the new “knio”- based Path types…)

Steve

1 Like