Split sting and add it to array

Hello,
I have the below string of countries, how can split it after “,” and add it to a String Array?

“Bahrain, Comoros, Djibouti, Egypt, Iraq, Jordan, Kuwait, Libya, Mauritania, Oman, Palestine, Qatar, Saudi Arabia, Somalia, Sudan, Syria”

Thanks in advance

@mosa_sleeman

YourStringVar.Split({“,”}, StringSplitOptions.RemoveEmptyEntries).Select(Function (x) x.Trim).toArray

is splitting, removing empty entries and triming the string

grafik

1 Like

@mosa_sleeman - Please find the starter help here…

Write Line: String.join(vbcr, StrCountriesArr)

Hi @mosa_sleeman,

To split the string into an array, put this into an assign:

StringVarArray = StringVar.Split({","},StringSplitOptions.None)

1 Like

@mosa_sleeman - Nope…just to print the output…I use write Line = string.join(vbcr, strarray) → This will print the each array item in the new line

Thanks

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