@Test public void truncateDoubleTest() { assertEquals("5", GeoWidgetUtils.truncateDouble("5")); assertEquals("-5", GeoWidgetUtils.truncateDouble("-5")); assertEquals("5.12", GeoWidgetUtils.truncateDouble("5.12")); assertEquals("-5.12", GeoWidgetUtils.truncateDouble("-5.12")); assertEquals("5.12", GeoWidgetUtils.truncateDouble("5.1234")); assertEquals("-5.12", GeoWidgetUtils.truncateDouble("-5.1234")); assertEquals("", GeoWidgetUtils.truncateDouble("")); assertEquals("", GeoWidgetUtils.truncateDouble(null)); assertEquals("", GeoWidgetUtils.truncateDouble("qwerty")); }
public static String truncateDouble(String s) { DecimalFormat df = new DecimalFormat("#.##"); try { return df.format(Double.valueOf(s)); } catch (Exception | Error e) { Timber.w(e); } return ""; }
GeoWidgetUtils { public static String truncateDouble(String s) { DecimalFormat df = new DecimalFormat("#.##"); try { return df.format(Double.valueOf(s)); } catch (Exception | Error e) { Timber.w(e); } return ""; } }
GeoWidgetUtils { public static String truncateDouble(String s) { DecimalFormat df = new DecimalFormat("#.##"); try { return df.format(Double.valueOf(s)); } catch (Exception | Error e) { Timber.w(e); } return ""; } private  GeoWidgetUtils(); }
GeoWidgetUtils { public static String truncateDouble(String s) { DecimalFormat df = new DecimalFormat("#.##"); try { return df.format(Double.valueOf(s)); } catch (Exception | Error e) { Timber.w(e); } return ""; } private  GeoWidgetUtils(); static String convertCoordinatesIntoDegreeFormat(Context context, double coordinate, String type); static double[] getLocationParamsFromStringAnswer(String answer); static String truncateDouble(String s); }
GeoWidgetUtils { public static String truncateDouble(String s) { DecimalFormat df = new DecimalFormat("#.##"); try { return df.format(Double.valueOf(s)); } catch (Exception | Error e) { Timber.w(e); } return ""; } private  GeoWidgetUtils(); static String convertCoordinatesIntoDegreeFormat(Context context, double coordinate, String type); static double[] getLocationParamsFromStringAnswer(String answer); static String truncateDouble(String s);  }