Unable to split a array of string

Hi,

I have a string (Invoice numbers) which I am getting from datarow. I need to split this string into individual items. The string looks like below format.

1573661473, 1064127539
1063135842, 1063135865
1063135926, 1064118204
1573657280, 1573657281
1064127539, 1573661473
1063136036, 1063136037
1573096301
1063137220, 1063137221
1573097055

I need the Data to be split with each Invoice number (for example ‘1573661473’). so that I can iterate through each Invoice number. can you please check.

3 Likes

Hi @ashok.p

I hope this might be helpful to you .Please see the link below for your reference.

cheers :smiley:

Happy learning :smiley:

4 Likes

@ashok.p

all these invoice numbers in a single string? or these are datarow values?

1 Like

Simple.
StrArrayVar= trim(yourstring). replace (“,”," “). split (” "c)
It will split by space and will store all the values in StrArrayVar .

2 Likes

@ashok.p,

Use Splits method with comma (,) & Newline.
Assign
ArrStr (Array Of String) = a.Split({",",Environment.NewLine},StringSplitOptions.None)

4 Likes

This comes in a single string.

1 Like

@ashok.p

You can split it based on comma then.

     arrInvoices [] = yourStr.Split(","c)
1 Like

@samir,

This is giving the result in a sets of 2 to 3 Invoice numbers. please see the output format below.
image

1 Like

@pattyricarte, thank you. checking on these.

2 Likes

You welcome @ashok.p

cheers :smiley:

Happy learning :smiley:

3 Likes

Okay, this will work for you @ashok.p,

ArrStr = Text.Split({vbLf,","},StringSplitOptions.RemoveEmptyEntries) 
1 Like

Hi @ashok.p ,

Regex_ToArray.xaml (7.2 KB)

Thanks!

3 Likes

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