using , as decimal point

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

using , as decimal point

NorbertHartl
Hi,

I like to use fractions in my web forms. Unfortunately everything regarding numbers is nailed to use a dot (.) as decimal separator. In magritte it should be fairly easy to delegate the decimal point to the MANumberDescription but then there is still Number class>>readFrom: that checks for dot  as well.

Do you have any ideas how to treat this case? I'm not sure if converting at the appropriate locations is feasible.

Norbert



_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: using , as decimal point

Lukas Renggli
> Do you have any ideas how to treat this case? I'm not sure if converting at the appropriate locations is feasible.

It is probably the easiest if you replace all the $, with $. before
you pass it on to #readFrom:

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: using , as decimal point

NorbertHartl

On 15.03.2010, at 09:10, Lukas Renggli wrote:

>> Do you have any ideas how to treat this case? I'm not sure if converting at the appropriate locations is feasible.
>
> It is probably the easiest if you replace all the $, with $. before
> you pass it on to #readFrom:
>
Do you think it is feasible to change

MAStringReader>>visitNumberDescription:

from

(contents occurrencesOf: $.) > 1
                ifTrue: [ MAReadError signal ].

to

(contents occurrencesOf: aDescription decimalPoint) > 1
                ifTrue: [ MAReadError signal ].
(contents occurrencesOf: aDescription decimalPoint) = 1
                ifTrue: [ contents := contents copyReplaceAll: aDescription decimalPoint with: '.' ].

?

Norbert
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: using , as decimal point

Lukas Renggli
Yes, that should do it.

On 15 March 2010 09:42, Norbert Hartl <[hidden email]> wrote:

>
> On 15.03.2010, at 09:10, Lukas Renggli wrote:
>
>>> Do you have any ideas how to treat this case? I'm not sure if converting at the appropriate locations is feasible.
>>
>> It is probably the easiest if you replace all the $, with $. before
>> you pass it on to #readFrom:
>>
> Do you think it is feasible to change
>
> MAStringReader>>visitNumberDescription:
>
> from
>
> (contents occurrencesOf: $.) > 1
>                ifTrue: [ MAReadError signal ].
>
> to
>
> (contents occurrencesOf: aDescription decimalPoint) > 1
>                ifTrue: [ MAReadError signal ].
> (contents occurrencesOf: aDescription decimalPoint) = 1
>                ifTrue: [ contents := contents copyReplaceAll: aDescription decimalPoint with: '.' ].
>
> ?
>
> Norbert
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>



--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki