I'm confused of how to compare string const with variable.
Look at this simple example where keyboard input compares with const string.
I suggest this is encoding problem. Please, tell me what should be done to
exit process ?
File encoding is utf8
process.stdin.setEncoding();//default is utf-8
process.stdin.resume();
process.stdin.on("data", function(text) {
//shows entered length=*6*
console.log('entered length=' + text.length);
//shows compare length=*4*
console.log('compare length=' + 'exit'.length);
if (text == 'exit'){
//never works
console.log('matched!');
}
});
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en