Jim Griffith

Splitting a string using a delimiter with unknown number of columns

Discussion created by Jim Griffith on May 15, 2015
Latest reply on May 15, 2015 by Pete Wirfs
I'm using a text field in a prompt set to have users specify multiple files separating each one by a comma. I need to then separate these file names from the variable. However, there could be 2 files specified or 20. I have a solution for this that I've used before essentially looking for the delimiter, taking the difference between the starting point and the delimiter and cutting that out and setting to a variable but I'm looking for a better way, if possible
  
Basically I need this..

&STRING# = 'JIM1.txt, JIM2.txt, JIM3.txt'

to be 

&STRING1# = 'JIM1.txt'
&STRING2# = 'JIM2.txt'
&STRING3# = 'JIM3.txt'

With the STR_SPLIT, it looks like I setup an array but I have to specify  the size of the array, which is unknown. I would have to script it to discover the number of commas, then set the array to that size and do the split. 

So...does anyone have an easier way to do this?

Thanks for any and all help!

Jim

Outcomes