parseDuration

Parse a duration string in the form returned by Duration.toString (e.g. "1 day, 1 hour and 30 minutes")

Duration
parseDuration
(
string s
)

Examples

assert(parseDuration("1 day, 1 hour and 30 minutes") == 1.days + 1.hours + 30.minutes);
assert(parseDuration("0.5 hours") == 30.minutes);
assert(parseDuration("0") == Duration.init);

Meta