Skip to content

Commit

Permalink
Implement upper and lower invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
atuonufure committed Aug 14, 2023
1 parent 3a9845c commit 1a68d5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fhirpathpy/engine/invocations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"startsWith": {"fn": strings.starts_with, "arity": {1: ["String"]}, "nullable_input": True},
"endsWith": {"fn": strings.ends_with, "arity": {1: ["String"]}, "nullable_input": True},
"contains": {"fn": strings.contains_fn, "arity": {1: ["String"]}, "nullable_input": True},
"upper": {"fn": strings.upper, "arity": {0: ["String"]}, "nullable_input": True},
"lower": {"fn": strings.lower, "arity": {0: ["String"]}, "nullable_input": True},
"replace": {"fn": strings.replace, "arity": {2: ["String", "String"]}, "nullable_input": True},
"matches": {"fn": strings.matches, "arity": {1: ["String"]}, "nullable_input": True},
"replaceMatches": {
Expand Down
10 changes: 10 additions & 0 deletions fhirpathpy/engine/invocations/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ def contains_fn(ctx, coll, substr):
return substr in string


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


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


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

0 comments on commit 1a68d5c

Please sign in to comment.