Panty v0.1.1 Panty.Collection

Collection utilities

Link to this section Summary

Functions

Returns the list dropping its last element

Get intersection from given lists

Get index of a substring from a pattern

Link to this section Functions

Link to this function initial(collection)
initial([any(), ...]) :: [any()]

Returns the list dropping its last element

Examples

iex> Tools.initial([1, 2, 3, 4])
[1, 2, 3]
Link to this function intersection(first, second)
intersection([any()], [any()]) :: [any()]

Get intersection from given lists.

Examples

iex> Collection.intersection([1, 2, 3, 4], [2, 3])
[2, 3]
iex> Collection.intersection(["index", "carousel", "header", "footer"], ["header", "footer"])
["header", "footer"]
Link to this function substring_index(pattern, substring)
substring_index(String.t(), String.t()) :: integer() | nil

Get index of a substring from a pattern.

Examples

iex> Collection.string_find_index("abcdef", "cde")
2
iex> Collection.string_find_index("{% sections 'header' %}", "{% endschema %}")
nil