How to get data from text file into a list with split method

Howdy,
I want to grab text from a text file which will have names on each line. I want to grab that and put it into a list using the split method in uipath and separate it with the new line character, \n. However I have tried doing that and I am not getting anything.

Sequence1.xaml (4.8 KB)

Hello Michael,

The problem is that the String.Split method wants a Character type, not a String for the standard version.

However, there’s an overload for the method that allows using strings. Try changing that Assign statement to: data.Split({"\n"}, StringSplitOptions.None)

Hi @dmccammond, thank you for your help. It looks like that did the trick! But i think the split method is not working properly. Recall the text file being read contains names on each line. It’s reading everything as one piece, the nums length is 1 instead of 12,hence 12 names.

Do you know why?

Here you go, it’s because vb.net doesn’t use the “\n” new line character to denote a new line, it uses the Windows’ carriage return + line feed characters. See this updated sample file that you gave.Sequence1.xaml (4.8 KB)

1 Like

Thx mate! Appreciate it!