A question for the engineers probably (if it hasnt been already answered I couldnt find it doing a search):
Integer.FromText throws a bad data exception if the text passed is not a number.
Double.FromText and Single.FromText dont they return a 0 if they were not successful.
Is that inconsistency chosen by design or by mistake?
And if the first: What is the reason?
[quote]Integer.FromText throws a bad data exception if the text passed is not a number.
Double.FromText and Single.FromText dont they return a 0 if they were not successful.[/quote]
Didn’t we have a major strop about this a year or two back with the new framework?
With several people saying there was nothing wrong with Val() which returns 0 for bad numbers, and
Xojo saying ‘no, we want to generate an exception which you will have to trap’
On that basis, Double.FromText and Single.FromText would seem be the ones that were ‘buggy’.
I’d be happy for them all to return 0
I think what I remember from the discussions was that ToText returns a value if it is a number. Zero is a number. Not a number should trigger an exception. Some said that they wished ToText worked more like Val() which can perfectly well accept for instance
“123 objects” and return 123.