posexional v1.0.0 Posexional.Field View Source

generic utility functions for fields

Link to this section Summary

Functions

true if the value passed contains only the filler value

nil if the value is an empty string, or a string containing only the filler

justify a value given alignment, size and filler char, if the given value is longer it gets trimmed

Link to this section Functions

Link to this function

contains_only?(v, filler)

View Source

true if the value passed contains only the filler value

Link to this function

depositionalize(content, field)

View Source
depositionalize(binary(), map()) :: binary()

nil if the value is an empty string, or a string containing only the filler

Link to this function

positionalize(value, map)

View Source
positionalize(binary(), map()) :: binary()

justify a value given alignment, size and filler char, if the given value is longer it gets trimmed

Examples

iex> Posexional.Field.positionalize("test",
...>   %{alignment: :left, size: 10, filler: ?\s})
"test      "

iex> Posexional.Field.positionalize("test",
...>   %{alignment: :right, size: 10, filler: ?\s})
"      test"

iex> Posexional.Field.positionalize("test",
...>   %{alignment: :right, size: 5, filler: ?\s})
" test"

iex> Posexional.Field.positionalize("test",
...>   %{alignment: :right, size: 5, filler: ?-})
"-test"

iex> Posexional.Field.positionalize("testtest",
...>   %{alignment: :right, size: 5, filler: ?-})
"testt"