type: fhirpath-functionfunction: splitcategory: Additional String Functionssection: 5.7.6source: fhirpath/functions.json
FHIRPath Function: split
{:.stu}
The split function splits a singleton input string into a list of strings, using the given separator. {:.stu}
If the input is empty, the result is empty. {:.stu}
If the input string does not contain any appearances of the separator, the result is the input string. {:.stu}
The following example illustrates the behavior of the .split operator:
{:.stu}
('A,B,C').split(',') // { 'A', 'B', 'C' }
('ABC').split(',') // { 'ABC' }
'A,,C'.split(',') // { 'A', '', 'C' }
Summary
- Category: Additional String Functions
- Section:
5.7.6 - Return Type:
collection - Empty Input Result:
empty - Errors on Multiple Input:
true
Description
Splits the input string using separator as the split point and returns a collection with one string for each portion of the input.
Arguments
Type Mapping
Example
'a,b,c,d,e'.split(',') // { 'a', 'b', 'c', 'd', 'e' }
'a b c'.split(' ') // { 'a', 'b', 'c' }