message.setEndOfLine¶
Signature: message.setEndOfLine(eol)
Returns: void
Set the end of line character(s) to use for this message. The eol value can only be set to '\r', '\r\n', or '\n' (X12 also allows '').
Note
This method only applies to the following formatted messages: HL7, ASTM, CSV, EDIFACT, Old Fxd Width, Fxd Length, JSON, X12.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | eol | the end of line character(s) to use for this message |
Example¶
// Example: Change the end-of-line (EOL) characters used by a message.
// assumes `message` is an HL7 message model object, like:
// MSH|^~\&|SendingApp|SendingFacility|ReceivingApp|ReceivingFacility|202311071230||ADT^A01|123456|P|2.3
// PID|1||123456^^^&1.2.3.4&ISO||Doe^Jane||19850515|F|||123 Elm St^^Somecity^ST^12345||(555)123-4567^PRN^PH^^^555^1234567
// Set end-of-line characters to LF
message.setEndOfLine("\n"); // lines now end with "\n" instead of "\r"