Beware of Parse

Integer.Parse is the new way of converting from Text to an Integer in the Xojo framework. One of the things it does NOT do is handle any number formatting.

For example, if you have “12,345” and use Parse it will give a result of 12. You will have to strip the formatting on your own. Less than ideal, IMO.

This might be well know, but it’s worth putting it out there so someone else doesn’t bang their heads against the wall for an hour like I did. FWIW, it was reported in June 2015 <https://xojo.com/issue/39645>.

There is where something like NSNumberFormatter (along with others likeNSDateFormatter etc) would be useful
And we have discussed such things for the new framework
They not only handle output (aka Format) but also input parsing
Instances of NSNumberFormatter format the textual representation of cells that contain NSNumber objects and convert textual representations of numeric values into NSNumber objects. The representation encompasses integers, floats, and doubles; floats and doubles can be formatted to a specified decimal position. NSNumberFormatter objects can also impose ranges on the numeric values cells can accept.

But - how would that work with non-NextSTEP based platforms? No NSNumberFormatter on Linux or Windows that I can find …

They’d have to create equivalents for those platforms.

There is where something like NSNumberFormatter (along with others likeNSDateFormatter etc) would be useful

Obviously we’d have to have something similar on other platforms

In France, that would be correct.
, is the decimal separator, so 12,345 is a real number between 12 and 13

Just chucking away the furniture isn’t the solution.

Cdbl() in the old framework gets you the likely value (12.345) based on international settings.
and then you can floor() that.

But if a French user gives you a string which is 12,345 and means ‘over 12 thousand’, you’re in trouble.
And if you dont know the source of the data…

CFLite is cross-platform.

However fix it should be really easy since you know the group separator and you can replace it.
(the problem exists when there is a locale)