Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 18 in printed book and digital formats -- plus a one-year subscription (beginning with 19.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 17.5 ('Numbers')
Instant purchase and download via GumRoad!

FEATURE

Numbers Please! (Part 4)

A numbers-only field

Issue: 17.5 (September/October 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: No description available.
Article Length (in bytes): 35,956
Starting Page Number: 12
Article Number: 175002
Related Link(s): None

Excerpt of article text...

Last time we delineated our RegEx pattern by capturing the over-arching structure of numbers as a RegEx pattern in pseudo RegEx:

NaN | [+-]? ( INF | ? | ( (int | dec | int dec) prec? )? exp? )

This time we will start implementing the RegEx for int, dec, prec, and exp that potentially form part of a "common number".

But before we do that, we need to deal with some potential problems, specifically those caused by grouping separators and decimal separators.

While we mentioned last time that the current international standard is to use a comma or dot as the decimal separator, and a thin space as a grouping separator, in reality different countries still use different grouping and decimal separators. So in the U.S. or Britain one would usually write 15,234.56, but in Germany or France it could be written as 15 234,56 or 15.234,56. But there is far more variety than that (for example an underbar as in maritime 21_450, and don't get me started on what some countries get up to), and the only sensible way of dealing with it is to use whatever the user set up as the locale setting. That way the user can modify that setting to suit his or her personal preference.

...End of Excerpt. Please purchase the magazine to read the full article.