3 ms·
Explaining a one-liner code with regular expression
- ksaj 6y agoThis is one subject where Canada must be a bit of a nightmare to code for. We typically use spaces instead of commas: 1 000 000.00. But if the number is shorter, we'll often use a comma to make it clear: 1,000.00 because numbers like 1 000.01 can look a little strange. There are lots of us that are happy to use all commas: 1,000,000.00 - we don't really think much of it as long as whatever you do, you do it consistently. We barely notice because we're so used to it. The reason I added the decimal is that we have French as an official national language. With French numbers, the comma and decimal symbols are swapped: 1.000,00 and 1.000.000,00 which changes everything about the one-liner.