Vector3 array from external .txt file

Somebody can paste an little example code that create a vector3 array from reading external .txt file. The file is a continuos list of point coordinate (x,y,z) spare by comma like this:

2,2,3,   //first point of first vector x,y,z
3,4,5,   //second point of first vector x1,y1,z1
2,2,2,   //first point of second point x2,y2,z2
1,1,1,   //second point of second vector x3,y3,z3


If you could leave off the comma at the end of the line, and they are each on separate lines, it would be easier. Also see And and

Once you have text in a string, you can split the lines with var pts = myString.Split(" "[0]) and then each resulting string, split by comma: var xyz = pts*.Split(","[0])

* *Ex (not tested, and no error checking done here)* *Input is:* *1,2,3* *4,5,6* *var vectors : Vector3[];*

var inputFile = ( read the string from the file any way you want, could be WWW )
var lines = inputFile.Split("
"[0]); // gets all lines into separate strings

vectors = new Vector3[lines.Length];
for (var i = 0; i < lines.Length; i++)
var pt = lines*.Split(“,”[0]); // gets 3 parts of the vector into separate strings*
var x = float.Parse(pt[0]);
var y = float.Parse(pt[1]);
var z = float.Parse(pt[2]);
vectors = new Vector3(x,y,z);