String.split into a string array

I am tying to split a list of items each on a new line. the code i am using is varriable lines default to text.split("\r\n")

How ever I am getting an error that "option strict on disallows implicit conversions from ‘string’ to ‘char’. I have tried slapping a toarray and tostring method at the end but I do not understand what that message is referring to

Its all good @tsorrill!

the split command needs a little extra love to make it work.
Hopefully this does the trick :wink:

Give a try on yourstringvar.Split({Environment.newline},StringSplitOptions.RemoveEmptyEntries)

1 Like

Hi @tsorrill,

The error message means that the Separator specified is not a Character array. Like @ppr & @Mr_Meeseeks mentioned you can convert the Environment.NewLine to a character array and that should resolve it strVar.Split(Environment.NewLine.ToCharArray,StringSplitOptions.RemoveEmptyEntries)



Hey @tsorrill
<Your_String_Var>.Split({Environment.NewLine,"\r\n","\n",vbCrLf, vbLf},System.StringSplitOptions.RemoveEmptyEntries)

Why i prefer this because based on my past experiences due to different text encodings sometime Environment.Newline does not work so if line feed is coming with cariage return den vb consent like vbCrLf and so works there.