mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-07 14:42:51 -04:00
27 lines
658 B
Java
27 lines
658 B
Java
package io.bitsquare.gui.util;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import java.text.DecimalFormat;
|
|
import java.text.ParseException;
|
|
import java.util.Locale;
|
|
|
|
public class Converter
|
|
{
|
|
private static final Logger log = LoggerFactory.getLogger(Converter.class);
|
|
|
|
public static double stringToDouble(String input)
|
|
{
|
|
try
|
|
{
|
|
DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(Locale.getDefault());
|
|
return decimalFormat.parse(input).doubleValue();
|
|
} catch (ParseException e)
|
|
{
|
|
log.warn(e.toString());
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
}
|