Load text into varaible and split

Not sure if this is the best way to do it but I want to have every individual line from a text file.

something like

variable=loadtextfile(“text.txt”);
variable.split(newline);

textfield.text=variable(2);

thats just something I came up with now, im sure it wont work =/
can someone tell em how to do this?