Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created May 26, 2012 03:48
Show Gist options
  • Save kuyseng/2792040 to your computer and use it in GitHub Desktop.
Save kuyseng/2792040 to your computer and use it in GitHub Desktop.
javascript: read name page file
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