diff options
| author | Bdale Garbee <bdale@gag.com> | 2015-07-16 13:31:42 -0600 | 
|---|---|---|
| committer | Bdale Garbee <bdale@gag.com> | 2015-07-16 13:31:42 -0600 | 
| commit | 6e9bb9178356620bd47d9f2e31abf42b7f1a8f11 (patch) | |
| tree | 6f04b5500462d1f6e26ebcba58c5e9cd56afd442 /altoslib/AltosParse.java | |
| parent | e2cefd8593d269ce603aaf33f4a53a5c2dcb3350 (diff) | |
| parent | 87c8bb3956897830da1f7aaca2990a9571767b73 (diff) | |
Merge branch 'master' into branch-1.6
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..8f624b96 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_8; +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);  		}  	}  | 
