How can i give multiple delimiters in a single var.split() syntax?
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?
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)
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}
I believe you can call split with an array of delimiters like this:
mystring.Split(new string {“=”, “,”}
Source: