readAsText: Save every line as an element in an array
126 views
Skip to first unread message
Joko
unread,
Feb 13, 2012, 12:34:11 AM2/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phonegap
Hello, I'm new in programming with JavaScript and have just
experiences in Python.
Actually I want to read a file and save every line as an element in an
array. Reading the file works great but I don't understand how I can
write every line to my array.
Thanks in advance ....
Kerri Shotts
unread,
Feb 13, 2012, 1:25:31 AM2/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phon...@googlegroups.com
Once it's read, you can split it up, like so:
var myArray = whatIRead.split("\r"); // split on UNIX-style line-endings (try \r\n or \n, depending on your line endings.)
Should work just fine...
Giacomo Balli
unread,
Feb 13, 2012, 1:58:14 AM2/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phonegap
you might want to clean with regexp first (double returns etc)
Joko
unread,
Feb 14, 2012, 2:32:06 AM2/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message