Skip to content

Instantly share code, notes, and snippets.

@hilukasz
Created May 21, 2012 19:14
Show Gist options
  • Save hilukasz/2764060 to your computer and use it in GitHub Desktop.
Save hilukasz/2764060 to your computer and use it in GitHub Desktop.
var myString;
var myStringLine;
var thePath = File.openDialog();
//alert(thePath);
function readPref (thePath) {
if (File(thePath).exists == true) {
var file = File(thePath);
//alert("file :: "+file);
file.open("r");
file.encoding= 'BINARY';
var theText = file.read();
file.close();
myString = String(theText).split(",");
myStringLine = String(theText).split(/\n/g);
alert('my string line: '+myStringLine);
}
};
var newLine = '\n';
readPref(thePath);
for(var i = 0; i < myString.length; i++){
if (myString[i] == newLine) {
alert('new line detected');
}
alert(myString[i])
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment