diff options
| author | Bdale Garbee <bdale@gag.com> | 2015-07-15 16:43:50 -0600 | 
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2015-07-15 16:43:50 -0600 | 
| commit | 643c2fb03833d658320f476ef731bbb06fe3cc31 (patch) | |
| tree | 878c9df5dbd9bab9169becea4e06e8bae3529541 /altoslib/AltosParse.java | |
| parent | e41786fb384892961a6547e17812a24314ce9623 (diff) | |
| parent | 271f56a41c7e785b0fab7e572325df842d104277 (diff) | |
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Diffstat (limited to 'altoslib/AltosParse.java')
| -rw-r--r-- | altoslib/AltosParse.java | 23 | 
1 files changed, 18 insertions, 5 deletions
| diff --git a/altoslib/AltosParse.java b/altoslib/AltosParse.java index 2fb69c15..de79c2fb 100644 --- a/altoslib/AltosParse.java +++ b/altoslib/AltosParse.java @@ -15,8 +15,9 @@   * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.   */ -package org.altusmetrum.altoslib_6; +package org.altusmetrum.altoslib_7; +import java.util.*;  import java.text.*;  public class AltosParse { @@ -40,11 +41,23 @@ public class AltosParse {  		}  	} -	public static double parse_double(String v) throws ParseException { +	static NumberFormat nf_locale = NumberFormat.getInstance(); + +	static NumberFormat nf_net = NumberFormat.getInstance(Locale.ROOT); + +	public static double parse_double_locale(String str) throws ParseException {  		try { -			return Double.parseDouble(v); -		} catch (NumberFormatException e) { -			throw new ParseException("error parsing double " + v, 0); +			return nf_locale.parse(str.trim()).doubleValue(); +		} catch (ParseException pe) { +			throw new ParseException("error parsing double " + str, 0); +		} +	} + +	public static double parse_double_net(String str) throws ParseException { +		try { +			return nf_net.parse(str.trim()).doubleValue(); +		} catch (ParseException pe) { +			throw new ParseException("error parsing double " + str, 0);  		}  	} | 
