View raw Markdown
type: fhirpath-operatoroperator: containscategory: Collectionssection: 6.4.3source: fhirpath/operations.json

FHIRPath Operator: contains (contains)

Returns true when the given substring is a substring of the input string.

If substring is the empty string (''), the result is true.

If the input collection is empty, the result is empty.

If the input collection contains multiple items, the evaluation of the expression will end and signal an error to the calling environment.

'abc'.contains('b') // true
'abc'.contains('bc') // true
'abc'.contains('d') // false

Note: The .contains() function described here is a string function that looks for a substring in a string. This is different than the contains operator, which is a list operator that looks for an item in a list.

Summary

Description

Returns true if the item in the right operand (single item collection) is in the left operand using equality semantics. If the right-hand side is empty, the result is empty; if the left-hand side is empty, the result is false. This is the converse operation of in.

Type Mapping