[Solved] Create a function to parse a string

I would like to create a function in a new extension that takes two string parameters:

1.	The string to parse
2.	The separator

I tried saving the results in an array that was already created as a scene variable, but it didn’t work. I’m not sure how to do this.

Important: I want to create this function to be able to return more than one value in a function. So, if a function can return a string with separators between each value, I can parse and use them. However, if there’s a better solution, I’m open to suggestions!

Thanks for your help.

You can create a parameter as a variable. There are actions to copy from the parameter variable and another to copy to the parameter variable.

You can add multiple variable parameters and copy new values to them or you could give the function an array or structure, modify and return them or just use the variables to return the values.

I don’t use this much. So, I needed to create a test project. So, I decided to share the pics.

The actions are here

I created 2 parameters

2 extension variables

These are the function events for an action

I tested it with a button and a text object using scene variables.

The scene events

This just increased each variable by 1.
Screenshot_20240906_234529_Chrome

To answer the parsing part. The array tools extension has a function that splits text to an array but the function approaches is simpler.

3 Likes

Thanks a lot for your great help!

1 Like