Android examples for java.lang:String Parse
parse value to double
//package com.java2s; import android.text.TextUtils; public class Main { /**//from ww w . j av a2s .c om * parse value to double */ public static double toDouble(Object value) { if (value instanceof Number) { return ((Number) value).doubleValue(); } return value == null ? 0 : toDouble(String.valueOf(value)); } /** * parse value to double */ public static double toDouble(String value) { return TextUtils.isEmpty(value) ? 0 : Double.parseDouble(value); } }