From 9a1cbbe68955e7717dbba6963c3b5dfcc07af526 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 6 Jan 2024 22:34:00 -0500 Subject: [PATCH] Update function to match test cases --- routines/ZipCodeValidation.m | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 routines/ZipCodeValidation.m diff --git a/routines/ZipCodeValidation.m b/routines/ZipCodeValidation.m new file mode 100644 index 0000000..aab5326 --- /dev/null +++ b/routines/ZipCodeValidation.m @@ -0,0 +1,9 @@ + ; https://www.isharkfly.com/t/mumps-zip-code-validation/15227 + R !,"Enter Zip:", address + D isValidZipCode(address,.error) + W !,error + Q +isValidZipCode(address,error) + S address = $EXTRACT(address,$LENGTH(address)-4,$LENGTH(address)) + I (address'?5N) S error="error zip code" q 0 + S error="" q 1