Rafael,

   The John's solution it´s better than mine.

regards

Wescley

2011/7/16 Rafał Laczek <rafal_lac...@wp.pl>

> Hi,
>
> Thanks for advice.
>
> Finally I sued
>
>  double val = Double.parseDouble(strValue.replace(oldChar, newChar));
>
> In my case it was:
>
>
> *double* resultDoub = Double.*parseDouble*(resultStr.replace(",", "."
>
> ));
>
> Regards,
>
> Rafal
>
>
>
> Dnia 16-07-2011 o godz. 18:09 John Masseria napisał(a):
>
> Take a look at NumberFormat:
>
>
> http://download.oracle.com/javase/1,5.0/docs/api/java/text/NumberFormat.html
>
>
>  public abstract class *NumberFormat*
> extends Format 
> <http://download.oracle.com/javase/1,5.0/docs/api/java/text/Format.html>
>
>  NumberFormat is the abstract base class for all number formats. This
> class provides the interface for formatting and parsing numbers.Â
> NumberFormat also provides methods for determining which locales have
> number formats, and what their names are.
>
> NumberFormat helps you to format and parse numbers for any locale. Your
> code can be completely independent of the locale conventions for decimal
> points, thousands-separators, or even the particular decimal digits used, or
> whether the number format is even decimal.
>
> To format a number for the current Locale, use one of the factory class
> methods:
>
>   myString = NumberFormat.getInstance().format(myNumber);
>
>
>  If you are formatting multiple numbers, it is more efficient to get the
> format and use it multiple times so that the system doesn't have to fetch
> the information about the local language and country conventions multiple
> times.
>
>  NumberFormat nf = NumberFormat.getInstance();
>  for (int i = 0; i < a.length; ++i) {
>      output.println(nf.format(myNumber[i]) + "; ");
>  }
>
>
>  To format a number for a different Locale, specify it in the call toÂ
> getInstance.
>
>  NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
>
>
>  You can also use a NumberFormat to parse numbers:
>
>  myNumber = nf.parse(myString);
>
>
> 2011/7/16 Rafał Laczek <rafal_lac...@wp.pl>
>
>> Hi Colleagues,
>>
>> In my application I have input string field.
>> String resultStr is parsed into double.
>> The problem is when resultStr is with "comma" eg. 2,3 instead of 2.3 (with
>> dot).
>> Can I solve it in any way?
>> Bellow is my current code.
>> double resultDoub =Double.parseDouble(resultStr);
>>
>> Thanks in advance for advice.
>>
>> Regards,
>> Rafal
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Java EE (J2EE) Programming with Passion!" group.
>> To post to this group, send email to
>> java-ee-j2ee-programming-with-passion@googlegroups.com
>> To unsubscribe from this group, send email to
>> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
>> For more options, visit this group at
>>
>> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Java EE (J2EE) Programming with Passion!" group.
> To post to this group, send email to
> java-ee-j2ee-programming-with-passion@googlegroups.com
> To unsubscribe from this group, send email to
> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
> For more options, visit this group at
>
> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Java EE (J2EE) Programming with Passion!" group.
> To post to this group, send email to
> java-ee-j2ee-programming-with-passion@googlegroups.com
> To unsubscribe from this group, send email to
> java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
> For more options, visit this group at
>
> http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to