Robert Klemme
10/12/2006 7:56:00 AM
On 11.10.2006 16:59, Josselin wrote:
> On 2006-10-11 15:37:03 +0200, "Tim Becker" <a2800276@gmail.com> said:
>
>>> I would like also to accept the european way (comma before decimal part)
>>> "99.999,99" or "99999,99' should also be substitued to "99999.99'
>>
>> "European" would be difficult without having context. How can you tell if
>> 999.999 is one short of a million or one thousanth short of a thousand?
>>
>> Apart from that, do you want to verify that the seperator is correctly
>> placed:
> all system amounts are purely informative .. (normal case is below
> 9999.99)
> and my concern is being flexible w validation
In that case it is even more important that you get it crystal clear (at
least for you) what values you will be accepting and how you will
interpret them! And then write a set of test cases that cover every
possible input you can imagine plus those that you cannot imagine.
> in this 3 cases the only thing the system cares is the decimal part :
>> 66'000.95 will be normalized to 66000.95
>> 650'00.95 will be normalized to 65000.95
>> ,0001.95 will ne normalized to 0001.95 => 1.95
> being accepted by the system, the use will see on display that they are
> not as they should be
> and the user will correct them later on....
Frankly, if I were you, I would code to reject the last one. I may be
missing something here but I do not know any notation / locale in which
this would be legal.
It is difficult to get i18n right, as you might start to imagine. :-)
If you can, try to add some contextual information (e.g. user's locale)
and - even better - utilize some library code for this.
My 0.02EUR...
Kind regards
robert