Subscribe Bookmark RSS Feed

Read in array from text file? Possible in JSL?

djhanson

Community Trekker

Joined:

Jun 23, 2011

Does anyone know if JSL can read in an array from a text file? any help much appreciated... dj

For example:

array1 = Include("C:\myArray.txt");
where the myArray.txt file would contain in its first line of text: "apple","pear","orange"

so that JSL would eventually interpret:

array1 = {"apple","pear","orange"};
1 REPLY
djhanson

Community Trekker

Joined:

Jun 23, 2011

After doing a little research I stumbled across the LoadTextFile command:). This solution below works great in case it helps others... So in this case I am able to store large arrays in a separate text file and read them directly into the JSL code. dj

array1 = parse(eval(LoadTextFile(eval()))); //where path is the text file's path+file name.txt which can be represented by a variable. In the text file I wrote the array exactly like this: {"apple","pear","orange"}

Message was edited by: djhanson