Created
May 26, 2012 03:48
-
-
Save kuyseng/2792040 to your computer and use it in GitHub Desktop.
javascript: read name page file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function read_name_page_file (name_page_file) { | |
var name_and_page = []; | |
var tmp_arr = []; | |
var tmp_str = ""; | |
if(name_page_file !=null) { | |
name_page_file.open("r"); | |
while(!name_page_file.eof){ | |
tmp_str = name_page_file.readln(); | |
tmp_arr = tmp_str.split("\t"); | |
if(tmp_arr.length == 2) { | |
name_and_page.push( {"name": tmp_arr[0], "page": tmp_arr[1]} ); | |
}; | |
}; | |
name_page_file.close(); | |
}; | |
return name_and_page; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment