Splitting Text to Array

I am using below expression to split a atring stored in temp variable on basis of new line to Array : temp.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries)
When using in Blank Process, it’s working fine but while using the same in RE Framework, giving error as ‘ToArray is not a member of string’. PFB the screenshot of the same. Don’t whether this issue is related to RE Framework or something else.
UiPath%20issue

Check the datatype of the variable you have assigned to… It must be in array of string (string[ ])

Should be Environment.NewLine.ToCharArray

Hi @rishabh.jain

Use following expression

Array(of string) = temp. Split(cchar(environment. Newline))

Regards
Ajay

1 Like

@rishabh.jain
Hi, to split by new line you can you expression: temp.Split(New String() {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
You can also use this expression to split by any word just replace Environment.NewLine to string you are willing to use.
ex: Split(New String() {“test”}, StringSplitOptions.RemoveEmptyEntries)

Hi @Sweety_Girl, @Jo.Ou, @Ajju and @rado,
Sorry for the late reply and thanks for trying to help.
Issue is System.Linq namespace is missing due to which it’s giving error. After Importing this namespace, ToArray option is also coming in my workflow.

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