/** * For a string containing a semitones delta as judged by <code>isSemitonesDelta()</code>, return the numerical value, as a * double. * * @param string * string * @return the numeric part of the semitones delta, or 0 if the string is not a valid semitones delta. */ public static double getSemitonesDelta(String string) { String s = string.trim(); if (!isSemitonesDelta(s)) return 0; String num = s.substring(0, s.length() - 2); double value = 0; try { value = Double.parseDouble(num); } catch (NumberFormatException e) { // logger.warn("Unexpected number value `" + num + "'"); } return value; }
/** * For a string containing a semitones delta as judged by <code>isSemitonesDelta()</code>, return the numerical value, as a * double. * * @param string * string * @return the numeric part of the semitones delta, or 0 if the string is not a valid semitones delta. */ public static double getSemitonesDelta(String string) { String s = string.trim(); if (!isSemitonesDelta(s)) return 0; String num = s.substring(0, s.length() - 2); double value = 0; try { value = Double.parseDouble(num); } catch (NumberFormatException e) { // logger.warn("Unexpected number value `" + num + "'"); } return value; }