How to give multiple delimiters

How can i give multiple delimiters in a single var.split() syntax?

Hello @diptojyotidutta

Could you share an example string which you are trying to split

2 Likes

Hi @Lahiru.Fernando
Below is the string which i want to split
Tax Invoice - U33/24/HD4-455 - 22/01/2019

So you want to split by “-” and “/” right?

2 Likes

by “space” and “-” i want to split it

By space and - ? Well there is a space next to each dash except one HDR-455. So I think it’s okay to split by dash only and trim the spaces. This will give you a array that contains

“Tax invoice”
" U33/24/HD4"
“455”
“22/01/2019”

Code to split would be var.Split("-"c)

2 Likes

Actually i want to have Tax invoice in one column, U33/24/HD4-455 in second and 22/01/2019 in third

So in my solution, once you split it will have the above listed items in a array right.

So if you use

Array(0).ToString will give you “Invoice Number”
Array(1).ToString - “U33/24/HD4-455”
Array(2).ToString - “22/01/2019”

So if you are add these to a datatable as three columns in one row use the add data row activity. In its property array row, use these as follows

{Array(0).ToString, Array(1).ToString, array(3).ToString}

3 Likes

I believe you can call split with an array of delimiters like this:

mystring.Split(new string {"=", “,”}

Source:

1 Like