Splitting a variable by the fourth comma

I have a variable SpecArrResult that has a value of (1234,2345),(4561,7891),(7899,8912). I need to split that variable out into two pieces (1234,2345),(4561,7891) and (7899,8912)
Can anyone tell me how to split this?

I was trying to copy your solution and it disappeared!! :frowning:


Part1=String.Join(","Matches.Take(2).Cast(of Match).Select(Function(m) m.value))


Am I creating variables for Matches, Part 1 and Part 2? And what is the Variable Type??


For Matches,Data type MatchesCollection
For Party&2 ,Data Type String

It says both ‘Take’ and 'Last" are not members of ‘System.Text.RegularExpressions.MatchCollection’


I saw its tricky question but I have Found Solution.
please check this one.


I basically need the String variable to split at the fourth comma - keep the first part, up to the comma as Var1 and everything after the comma to Var2.

Hi Karen,

This may be a bit of a work-around, but to make it easier to separate the sections, I cheated by using variable.replace(“),(”,“).(”) so that you can do a split based on a period while leaving the other commas in tact.
After that separated into 3 variables and using concat to combine the first two.

It works, but is not very scalable. I hope it helps. See attached.

SplitTest.xaml (6.5 KB)

Hey @karen.c.stewart4.civ

Is it always the fourth comma or the comma before the last element ?

Kindly confirm.



It is always the comma after the first two sections…so it would be the fourth comma.

Hi Karen,
I have joined your array into a single string and split into two values according to your requirement. Kindly check the attached workflow and let me know if you have any queries. Please mark this as an answer if it works :slight_smile:

Thanks & Regards
Ponganesh S K

split.xaml (6.7 KB)

Oh this worked just as expected!!! Thank you so much for all your assistance. It is much appreciated.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.