--- type: "fhirpath-function" title: "FHIRPath Function: contains" function: "contains" category: "String Manipulation" section: "5.6.6" source: "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. ``` 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**: 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 - `substring`: `String` - Substring to check ## Type Mapping - `String-Boolean` ## Example ```fhirpath 'abc'.contains('b') // true 'abc'.contains('bc') // true 'abc'.contains('d') // false ```