I am trying to add a line break in between two strings in node js inside a lambda function.
I have tried using '\n' , '\r\n' and also tried importing os and then using os.EOL statement, but none of these worked.
------------------------Using '\n'-------------------------------
var msg = `The order(s) for the customer ${CustomerNumber} and its status are ${data}`
msg+='\n'
msg+= ' To know the order details of another customer enter the customer
-------------------------- Using '\r\n' -------------------------------
var msg = `The order(s) for the customer ${CustomerNumber} and its status are ${data}`
msg+='\n'
msg+= ' To know the order details of another customer enter the customer number'
-------------------------- Using 'os.EOL' -------------------------------
var os = require("os");
var msg = `The order(s) for the customer ${CustomerNumber} and its status are ${data}`+os.EOL+' To know the order details of another customer enter the customer number'
-------------- Sending msg string to the AWS lex bot----------------------
callback(elicitSlot(sessionAttributes, deliveryStatus, slots, "CustomerNumber", {
'contentType': 'PlainText',
'content': msg
} ));
function elicitSlot(sessionAttributes, intentName, slots, slotToElicit, message) {
return {
sessionAttributes,
dialogAction: {
type: 'ElicitSlot',
intentName,
slots,
slotToElicit,
message,
},
};
}
all these had node effect, and the output i got was without a line break and as a continuous string
The output which i am expecting is: "The order(s) for the customer abcd and its status are 1234, 5678, 9876 " To know the order details of another customer enter the customer number'
Output what i am getting is: "The order(s) for the customer abcd and its status are 1234, 5678, 9876 " To know the order details of another customer enter the customer number'
I think it is because i am giving the content type as 'plain text', can anyone suggest me a solution?
), specify in the css that the browser should respect your linebreaks or wrap it in a – pizzamonster Jun 17 '19 at 13:17