-1
이 내 코드입니다 :문자열에서 줄 바꿈을 제거하는 방법?
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (text) {
text.replace(/\r?\n|\r/g, "");
console.log("Command: " + text + "textthatshouldbeinthesameline");
if (text == 'quit') {
console.log("Quitting");
done();
}
});
function done() {
console.log('Now that process.stdin is paused, there is nothing more to do.');
process.exit();
}
그리고이 발생하는 것입니다 : 당신이 보는대로
일부 줄 바꿈이있는 것 같다, 나는 그들을 대체하려고했지만 :없이 효과.
"quit"을 입력하면 if 문에서도 인식되지 않습니다.
실제로 O.o 바보 같은 실수를 내가 좀 더 복잡한 일 이었지만 : P – Piotrek