/** * For a string containing a percentage delta as judged by <code>isPercentageDelta()</code>, return the numerical value, * rounded to an integer. * * @param string * string * @return the numeric part of the percentage, rounded to an integer, or 0 if the string is not a valid percentage delta. */ public static int getPercentageDelta(String string) { String s = string.trim(); if (!isPercentageDelta(s)) return 0; return getNumberDelta(s.substring(0, s.length() - 1)); }
/** * For a string containing a percentage delta as judged by <code>isPercentageDelta()</code>, return the numerical value, * rounded to an integer. * * @param string * string * @return the numeric part of the percentage, rounded to an integer, or 0 if the string is not a valid percentage delta. */ public static int getPercentageDelta(String string) { String s = string.trim(); if (!isPercentageDelta(s)) return 0; return getNumberDelta(s.substring(0, s.length() - 1)); }