Article Preview
Buy Now
FEATURE
Numbers Please! Part 5
A numbers-only field
Issue: 17.6 (November/December 2019)
Author: Markus Winter
Author Bio: Markus is a Molecular Biologist who taught himself REALbasic programming in 2003 to let the computer deal with some exceedingly tedious lab tasks. Some call it lazy, he thinks it smart. He still thinks of himself as an advanced beginner at best.
Article Description: graphicbox>
Article Length (in bytes): 20,892
Starting Page Number: cy
Article Number: 17602
Related Link(s): None
Excerpt of article text...
In our continuing quest to build a proper numbers-only field, in this issue we will implement the RegEx for
dec
,prec
, andexp
that potentially form part of a "common number." Things should be rather straight-forward as we already did most of the heavy lifting when dealing with the integer part of a number and will be able to re-use quite a bit of what we did there. So let's get straight into it... after a small interlude.
A small change and a simplification before we begin. As the boolean
UseGroupingForFourDigitNumbers
is not particularily well named (Does it mean you group four digits together or do you group four digits into groups of three?) I have renamed it toKeepFourDigitIntegersTogether
and adjusted the code accordingly (by swapping the code in theif...then
andelse
sections).For
dec
we had also stated that
- The international standard is that you cannot omit the zero when the number is between +1 and -1. We could, however, allow entry without a zero as in ".07" and convert it to "0.07" automatically.
...End of Excerpt. Please purchase the magazine to read the full article.