tomlex v0.0.5 Tomlex.StringHelpers
A set of conveniencies to use with strings.
Summary
Functions
Casts the strings "true"
and "false"
to their boolean counterparts.
Returns the string unchanged otherwise
Casts a string to the more appropriate elixir type. If the string cannot be casted to any of the valid types for tomlex, it will return the string unchanged
Removes quotes and escaped characters from a string
Types
Functions
Casts the strings "true"
and "false"
to their boolean counterparts.
Returns the string unchanged otherwise.
Examples
iex> Tomlex.StringHelpers.booleanize_string("true")
true
iex> Tomlex.StringHelpers.booleanize_string("not boolean")
"not boolean"
Casts a string to the more appropriate elixir type. If the string cannot be casted to any of the valid types for tomlex, it will return the string unchanged.
Examples
iex> Tomlex.StringHelpers.cast_string("123")
123
iex> Tomlex.StringHelpers.cast_string("123.4")
123.4
iex> Tomlex.StringHelpers.cast_string("false")
false
iex> Tomlex.StringHelpers.cast_string("random string")
"random string"