point86 Posted December 6, 2006 Share Posted December 6, 2006 Hi,Im fairly new to javascript etc so please be patient! :DIm have a text file which I need to split into strings, and then enter these strings into an arrray.Thus, I have something like this:1 hello2 how are you3 goodbyeI want to split this into strings (with each line being a new string) and turn this into the following:a[0] = 'hello'a[1] = 'how are you'a[2] = 'goodbye'Once in the array, the numbers in the original text become unimportant. Now I know that this can be achieved with an arraylist and possibly a scanner(?). But I dont know the syntax to implement these constructs.Any help would be much appreciated! :DThanksPoint86. Link to comment https://forums.phpfreaks.com/topic/29662-strings-into-an-array/ Share on other sites More sharing options...
mithu_sree Posted December 11, 2006 Share Posted December 11, 2006 How will u open ur file?Do u think Javascript supports file handling? Link to comment https://forums.phpfreaks.com/topic/29662-strings-into-an-array/#findComment-138872 Share on other sites More sharing options...
fenway Posted December 16, 2006 Share Posted December 16, 2006 And, more so, I don't know what you're trying to accomplish. Link to comment https://forums.phpfreaks.com/topic/29662-strings-into-an-array/#findComment-142157 Share on other sites More sharing options...
artacus Posted December 17, 2006 Share Posted December 17, 2006 I concur, what you're doing doesn't make sense. Nonetheless, you can use PHP to read the file and generate a JS array in your document. Link to comment https://forums.phpfreaks.com/topic/29662-strings-into-an-array/#findComment-142668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.