Splitting a string on several different seperators

I have a column in an excel file with a bunch of dates, that won’t be parsed as dates. Therefore I have to split them, reassemble them, and convert them to dates. Dates can be in many formats like 1/1/2020, 1-1-2020 or even 1.1.2020.

I wish to be able to seperate the string on all these seperators, that is backslash, hyphen and dot. I am aware that I could use and if statement, or a switch, to check what the seperator is, but I feel like it’s too messy. I’ve tried using the split string activity from the microsoft package, but it dosn’t really work, see screenshot.

Thank you!
splitting_string

Hi,

Can you try the following expression?

yourString.Split("./-".ToCharArray)

If you want to split it by any non-numeric character, the following will also work.

System.Text.RegularExpressions.Regex.Split(yourString,"\D")

Regards,

1 Like

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