View Source LibJudge.Util (lib_judge v0.4.4)

A collection of utilities used inside lib_judge.

Link to this section Summary

Functions

Maps a month or number string into a number.

Link to this section Functions

@spec date_map(binary()) :: integer()

Maps a month or number string into a number.

This only converts months when they form the full length of the string, because it assumes you have split on whitespace before calling.

Non-month strings are converted using Integer.parse/1

examples

Examples

iex> LibJudge.Util.date_map("December")
12
iex> LibJudge.Util.date_map("37")
37
iex> LibJudge.Util.date_map("15 December")
15