mpd v0.1.0 Mpd.Utils View Source
Link to this section Summary
Functions
Convert an integer value to boolean. MPD uses 1 as true and it gets read as a string from the output.
Formats a time in second to "MM:SS" format.
Includes logging helpers to do logging using module name as namespace.
Checks if two strings are insensitively like. Since it does a to_string/1
it can handles almost any stringable format.
Parses a float from a string in safe way returning a 0.0 in the case of a failure
Parses an int from a string in safe way returning a 0 in the case of a failure
Link to this section Functions
Specs
Convert an integer value to boolean. MPD uses 1 as true and it gets read as a string from the output.
Specs
Formats a time in second to "MM:SS" format.
Includes logging helpers to do logging using module name as namespace.
Specs
Checks if two strings are insensitively like. Since it does a to_string/1
it can handles almost any stringable format.
It also support list to compare against as a second parameter
Examples
iex> str = "Primus - Too many puppies"
"Primus - Too many puppies"
iex> Mpd.Utils.string_like?(str, "pri")
true
iex> Mpd.Utils.string_like?(str, "pup")
true
iex> Mpd.Utils.string_like?("Primus - Too many puppies", ["IAM", "Primus"])
true
iex> Mpd.Utils.string_like?("Primus - Too many puppies", ["Pink Floyd"])
false
Specs
Parses a float from a string in safe way returning a 0.0 in the case of a failure
Specs
Parses an int from a string in safe way returning a 0 in the case of a failure