Skip to content

Instantly share code, notes, and snippets.

@kuyseng
Created May 26, 2012 03:17
Show Gist options
  • Save kuyseng/2791919 to your computer and use it in GitHub Desktop.
Save kuyseng/2791919 to your computer and use it in GitHub Desktop.
javascript: read from file as string
function build_string_from_name_page_file (name_page_file) {
var all_name_string = "";
var tmp_arr = [];
var tmp_str = "";
if(name_page_file !=null) {
all_name_string = "::";
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) {
all_name_string += ( tmp_arr[0] + "::" );
};
};
name_page_file.close();
};
return all_name_string;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment