--- type: "fhirpath-operator" title: "FHIRPath Operator: contains (contains)" operator: "contains" category: "Collections" section: "6.4.3" source: "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. ``` fhirpath '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`](#contains-containership--boolean) operator, which is a list operator that looks for an item in a list. ## Summary - **Category**: Collections - **Section**: `6.4.3` - **Left Argument**: `collection` - **Right Argument**: `Any` - **Return Type**: `Boolean` - **Empty Input Result**: `false` - **Errors on Multiple Input**: `false` ## 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 - `collection-Any`