type: fhirpath-functionfunction: containscategory: String Manipulationsection: 5.6.6source: fhirpath/functions.json
FHIRPath Function: 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 thecontainsoperator, which is a list operator that looks for an item in a list.
Summary
- Category: String Manipulation
- Section:
5.6.6 - Return Type:
Boolean - Empty Input Result:
empty - Errors on Multiple Input:
true
Description
Returns true when the given substring is a substring of the input string.
Arguments
Type Mapping
Example
'abc'.contains('b') // true
'abc'.contains('bc') // true
'abc'.contains('d') // false