HL7v2.Type.ST (HL7v2 v3.10.1)

Copy Markdown View Source

String Data (ST) -- HL7v2 primitive data type.

Lossless storage: the value is stored and returned as a plain binary string. No delimiter rejection, length enforcement, or charset validation is performed. The HL7 spec limits ST to 199 printable characters excluding delimiters, but this implementation preserves all input bytes for round-trip fidelity.

Summary

Functions

Encodes a string value. Returns the string as-is, or empty string for nil.

Parses a string value. Returns the string as-is, or nil for empty/nil input.

Functions

encode(value)

@spec encode(binary() | nil) :: binary()

Encodes a string value. Returns the string as-is, or empty string for nil.

Examples

iex> HL7v2.Type.ST.encode("Hello")
"Hello"

iex> HL7v2.Type.ST.encode(nil)
""

parse(value)

@spec parse(binary() | nil) :: binary() | nil

Parses a string value. Returns the string as-is, or nil for empty/nil input.

Examples

iex> HL7v2.Type.ST.parse("Hello")
"Hello"

iex> HL7v2.Type.ST.parse("")
nil

iex> HL7v2.Type.ST.parse(nil)
nil