Skip to content

Commit

Permalink
Implement trim invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
atuonufure committed Aug 14, 2023
1 parent 2f75ede commit 5e1bfea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions fhirpathpy/engine/invocations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
},
"length": {"fn": strings.length, "nullable_input": True},
"split": {"fn": strings.split, "arity": {1: ["String"]}, "nullable_input": True},
"trim": {"fn": strings.trim, "nullable_input": True},
"abs": {"fn": math.abs},
"ceiling": {"fn": math.ceiling},
"exp": {"fn": math.exp},
Expand Down
5 changes: 5 additions & 0 deletions fhirpathpy/engine/invocations/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def split(ctx, coll, delimiter):
return string.split(delimiter)


def trim(ctx, coll):
string = ensure_string_singleton(coll)
return string.strip()


# test function
def matches(ctx, coll, regex):
string = ensure_string_singleton(coll)
Expand Down

0 comments on commit 5e1bfea

Please sign in to comment.