-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFhirPathFunctions.cs
More file actions
30 lines (26 loc) · 959 Bytes
/
FhirPathFunctions.cs
File metadata and controls
30 lines (26 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Hl7.Fhir.ElementModel;
using Hl7.FhirPath.Expressions;
using Hl7.FhirPath;
using System.Collections.Generic;
using System.Linq;
namespace Fhir
{
public static class FhirPathFunctions
{
public static string Upper(this IElementNavigator nav)
{
return nav.Value?.ToString().ToUpper();
}
public static string Glue(this IEnumerable<IElementNavigator> navigators, string glue)
{
// glue is more original and widely known name than string.Join
string result = string.Join(glue, navigators.Select(n => n.Value?.ToString()));
return result;
}
public static void AddSimplifierFunctions(this SymbolTable symbols)
{
symbols.Add("upper", (IElementNavigator f) => f.Upper(), doNullProp: true);
symbols.Add("glue", (IEnumerable<IElementNavigator> f, string glue) => f.Glue(glue), doNullProp: true);
}
}
}