View Source LibJudge.Util (lib_judge v0.4.8)

A collection of utilities used inside lib_judge.

Summary

Functions

Maps a month or number string into a number.

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

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