You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Sven Homburg <sv...@hsofttec.com> on 2001/11/17 19:24:13 UTC
decimal-seperator in BigDecimalField
Hi there,
in germany we use the comma as decimal-seperator.
so here we have a little problem the the intake-model
BigDecimalField.
i think a little workaround is to change the
doSetValue-methode like this:
/**
* converts the parameter to the correct Object.
*/
protected void doSetValue(ParameterParser pp)
{
if ( isMultiValued )
{
String[] ss = pp.getStrings(getKey());
BigDecimal[] ival = new BigDecimal[ss.length];
for (int i=0; i<ss.length; i++)
{
ival[i] = new BigDecimal(ss[i].replace(',','.'));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
setTestValue(ival);
}
else
{
setTestValue( new BigDecimal(pp.getString(getKey()).replace(',','.')) );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
}
more configureable if we can update the intake.xml
with a new attribute "decimalseperator" where we can
set the wanted decimal-seperator.
--
Best regards
homburg Softwaretechnik
Sven Homburg
21220 Seevetal
http://www.hsofttec.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: decimal-seperator in BigDecimalField
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Sven Homburg <sv...@hsofttec.com> writes:
> in germany we use the comma as decimal-seperator.
> so here we have a little problem the the intake-model
> BigDecimalField.
> i think a little workaround is to change the
> doSetValue-methode like this:
>
> /**
> * converts the parameter to the correct Object.
> */
> protected void doSetValue(ParameterParser pp)
> {
> if ( isMultiValued )
> {
> String[] ss = pp.getStrings(getKey());
> BigDecimal[] ival = new BigDecimal[ss.length];
> for (int i=0; i<ss.length; i++)
> {
> ival[i] = new BigDecimal(ss[i].replace(',','.'));
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
> setTestValue(ival);
> }
> else
> {
> setTestValue( new BigDecimal(pp.getString(getKey()).replace(',','.')) );
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
> }
Hi Sven. I believe that all of Intake needs to be localized. I'm
currently working on this in the jakarta-turbine-fulcrum repository.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>