Skip to content

qie.escapeASTM

Signature: qie.escapeASTM(value, field*, repeat*, comp*, escape*)

Returns: String escapedValue - the escaped value

Escape the value for safe use in an ASTM message field.

Note

Segment delimiters CR ('\r') and LF ('\n') will be escaped as '&X0D&' and '&X0A&'.

Parameters

Type Name Description Default
String value the value to be escaped
String field* (optional) the ASTM field delimiter character |
String repeat* (optional) the ASTM field value repeat character \
String comp* (optional) the ASTM field component delimiter character ^
String escape* (optional) the ASTM escape character &

Example

var astmString = `
H|~^\\&|95243|HAMMO001|COMMUNITY AND FAMILY MEDICINE|BOX 2914^DUKE UNIVERSITY MEDICAL CENTER^DURHAM^NC|919-684-6721|THIS IS A TEST TO SEE IF WE CAN MAKE THIS BREAK INTO ANOTHER SEGMENT|SMITHKLINE CLINICAL LABS|
A|TEST MESSAGE|D|2|199401170932
P|1|999-99-9999|||GUNCH^MODINE^SUE|00279~1&2&3&4^00998~2&3&4&5^00998~3&4&5&6|19430704|F|RT 1, BOX 97^ZIRCONIA^NC^27401||704-982-1234||DOCTOR^PRIMARY^A^^DR.
O|1|101||80018^CHEM 18|R||||N|||||MD&PRIMARY&A&DR.
O|2|102||85025^AUTO CBC|R||||N|||||MD&PRIMARY&A&DR.H
L|1||3
`;
var astmMessage = qie.parseASTMString(astmString);

var newName = "COMMUNITY & FAMILY MEDICINE"; // Value with special characters
astmMessage.setNode('H-5', qie.escapeASTM(newName));