Change variable IEnumerable<match> to string

Hello guys, here are the extracted data from regex


I want to change the variable to string and the result should be
(4500043209,4500043211,4500043213,4500043215,4500043217,4500043219,4500043221,4500043223,4500043225…) with comma “,”
can you guys help me
thank you

1 Like

Hello @Aluneth_X
try using
String.Join(“,”,Variable)

2 Likes

Yah that’s possible
—pass the output directly to a assign activity with a string variable named out_text like this

out_text = “(“+String.Join(“,”,matchhes.ToArray())+”)”

Or

out_text = “(“+String.Join(“,”,(From p in matchhes
Select Convert.ToString(p)).ToArray()))+”)”

Hope this would help you buddy
Cheers @Aluneth_X

3 Likes

i created a string variable but there is some error


do u mind take a look to my workflow?
thanksMatches.xaml (6.6 KB)

Hi with e.g. String.Join(“,”,Variable) you get a flattened string. This does mean, all matches are appended into one string, seperated in your case with a “,”

The for each loop is then iterating over all single characters and writes for each iteration the single character out. I dont know all your requirements but I assume the for each is not necessary. Just inspect the result of out_text by debugging in the locals panel or do a write line to check the result.

1 Like

thank you good sir

thank you

you copied in your case the statement without taking care of your specific variable name.
String.Join(", ",matchhes) should work but please have a look on your typo in the variable name matchhes

1 Like

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