From f41fdda496ecfb81bde35ae8d17711c8ab527453 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 31 Aug 2017 11:17:49 -0500 Subject: [PATCH] Modify # function to detect long sequences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Long sequences (like a Base64 encoding) are returning an error. GetAsNumber ( Base64 encoding) is returning "", but the comparison "value ≠ ~number" is returning False, so ~value is set to ~number which is empty. I found two solutions, changing the comparison to "value ≠ GetAsNumber ( ~number ) ;" and adding " or number = "" " to the first Case test that assigns to "~value". I suggest the first as it will short circuit the Case tests preventing unneeded comparisons. I don't believe it will interfere with date/time/timestamp/number values as they should not return an empty string from GetAsNumber. My limited testing confirms this, but further testing/brighter minds may see something I don't. --- Functions/#Name-Value/#.fmfn | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Functions/#Name-Value/#.fmfn b/Functions/#Name-Value/#.fmfn index 1e1b194..52d17f5 100644 --- a/Functions/#Name-Value/#.fmfn +++ b/Functions/#Name-Value/#.fmfn @@ -16,6 +16,8 @@ * DEPENDENCIES: none * * HISTORY: + * MODIFIED on 2017-08-31 by Nick Lewis nilness@gmail.com to fix an + * issue where long sequences of text could be interpreted as numbers. * MODIFIED on 2014-10-07 by Daniel Smith dansmith65@gmail.com to prevent * from returning an EvaluationError. * MODIFIED on 2014-06-06 by Jeremy Bante to fix an @@ -63,7 +65,7 @@ Let ( [ ~number = GetAsNumber ( value ) ; ~value = Case ( - value = "" or value = "?" or ~number = "?" ; + value = "" or value = "?" or ~number = "?" or number = ""; Quote ( value ) ; ~isValidDate @@ -128,4 +130,4 @@ Let ( [ /* Else */ ~result ) -) \ No newline at end of file +)