Ruby Min and max from hour string array -
i'm trying min , max values array of hr strings.
so, array is:
["09:00", "11:10", "10:00", "20:00", "15:00"]
i've tried utilize gsub on elements remove :
, convert int
, later utilize minmax
function, unsuccessful. don't want create uggly code solve problem.
is there beautiful way that?
provided have leading zeros:
["09:00", "11:10", "10:00", "20:00", "15:00"].minmax #=> ["09:00", "20:00"]
ruby arrays
No comments:
Post a Comment