@Test(expected = IllegalArgumentException.class) public void meaningfulFailure() { TimeUtils.millisFromDuration( "14z" ); }
public static long millisFromDuration( String durationStr ) { long total = 0; MultiplierToken mt; long dur; for ( String val : Splitter.on( ',' ).trimResults().omitEmptyStrings().split( durationStr ) ) { dur = Long.parseLong( CharMatcher.DIGIT.retainFrom( val ) ); mt = MultiplierToken.from( val.charAt( val.length() - 1 ) ); total += ( mt.multiplier * dur ); } return total; }
TimeUtils { public static long millisFromDuration( String durationStr ) { long total = 0; MultiplierToken mt; long dur; for ( String val : Splitter.on( ',' ).trimResults().omitEmptyStrings().split( durationStr ) ) { dur = Long.parseLong( CharMatcher.DIGIT.retainFrom( val ) ); mt = MultiplierToken.from( val.charAt( val.length() - 1 ) ); total += ( mt.multiplier * dur ); } return total; } }
TimeUtils { public static long millisFromDuration( String durationStr ) { long total = 0; MultiplierToken mt; long dur; for ( String val : Splitter.on( ',' ).trimResults().omitEmptyStrings().split( durationStr ) ) { dur = Long.parseLong( CharMatcher.DIGIT.retainFrom( val ) ); mt = MultiplierToken.from( val.charAt( val.length() - 1 ) ); total += ( mt.multiplier * dur ); } return total; }  }
TimeUtils { public static long millisFromDuration( String durationStr ) { long total = 0; MultiplierToken mt; long dur; for ( String val : Splitter.on( ',' ).trimResults().omitEmptyStrings().split( durationStr ) ) { dur = Long.parseLong( CharMatcher.DIGIT.retainFrom( val ) ); mt = MultiplierToken.from( val.charAt( val.length() - 1 ) ); total += ( mt.multiplier * dur ); } return total; }  static long millisFromDuration( String durationStr ); }
TimeUtils { public static long millisFromDuration( String durationStr ) { long total = 0; MultiplierToken mt; long dur; for ( String val : Splitter.on( ',' ).trimResults().omitEmptyStrings().split( durationStr ) ) { dur = Long.parseLong( CharMatcher.DIGIT.retainFrom( val ) ); mt = MultiplierToken.from( val.charAt( val.length() - 1 ) ); total += ( mt.multiplier * dur ); } return total; }  static long millisFromDuration( String durationStr );  }