View raw Markdown
type: fhirpath-functionfunction: encodecategory: Additional String Functionssection: 5.7.1source: fhirpath/functions.json

FHIRPath Function: encode

{:.stu}

The encode function takes a singleton string and returns the result of encoding that string in the given format. The format parameter defines the encoding format. Available formats are: {:.stu}

|hex |The string is encoded using hexadecimal characters (base 16) in lowercase | |=|=| |base64 |The string is encoded using standard base64 encoding, using A-Z, a-z, 0-9, +, and /, output padded with = | |urlbase64 |The string is encoded using url base 64 encoding, using A-Z, a-z, 0-9, -, and _, output padded with = | |ascii | The string has any character above character code 127 replaced with ?. This is a lossy encoding, and not reversible via decode {:.grid} {:.stu}

Base64 encodings are described in RFC4648. {:.stu}

If the input is empty, the result is empty. {:.stu}

If no format is specified, the result is empty. {:.stu}

Summary

Description

The encode function takes a singleton string and returns the result of encoding that string in the given format. Available formats are hex, base64, and urlbase64.

Arguments

Type Mapping

Example

'test'.encode('hex') // returns hexadecimal representation