I am getting this format from a json string:
JavaScript
x
ABCDn EFG: HIJKLn
MNO: PQRST nn
UVW: XYZ
When I print it, the line breaks (“n”) is not inserted. I get the Json string like so:
JavaScript
val orReply = gson.fromJson<OrReply>(decryptedValue, OrReply::class.java)
printReceipt(orReply.ORData)
and use this reply as so:
JavaScript
private fun printReceipt(orString: String) {
printOnPrinter(orString)
}
Advertisement
Answer
Try the following function to process the line breaks and see if helps you in fixing the issue:
JavaScript
private fun processLineBreak(string: String) : String{
return string.replace("n",System.lineSeparator())
}