I propose that *String.to_integer/1* return an integer rather than raising an error when passed an integer argument.
*Use case:* When working with Phoenix LiveView and HEEx templates, database table *id* values are processed as both binary values and integer values, but must be converted back to integer when writing to the database. When *String.to_integer/1* is passed an integer value, it raises an error. We add functions in our projects to make string to integer conversion more forgiving, such as the following functions found in the elixir library * defp to_integer(integer) when is_integer(integer), do: integer* * defp to_integer(integer) when is_binary(integer), do: String.to_integer(integer)* sourced from here: https://github.com/elixir-lang/elixir/blob/79cd891eb86ecb7654a7acdb63769cfdd950a5c0/lib/ex_unit/lib/ex_unit/filters.ex#L238 -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/2fdcbff9-5551-4e91-aea1-68fc7447adfan%40googlegroups.com.