Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
saleyn committed Oct 25, 2023
1 parent bf02705 commit 26d3983
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,23 +335,23 @@ end.

This module implements a transform to stringify an Erlang term.

* `str(Term)` is equivalent to `lists:flatten(io_lib:format("~p", [Term]))` for
terms that are not integers, floats, atoms, binaries and lists.
Integers, atoms, and binaries are converted to string using `*_to_list/1`
functions. Floats are converted using `float_to_list/2` where the second
argument is controled by `str:set_float_fmt/1` and `str:reset_float_fmt/0`
calls. Lists are converted to string using
`lists:flatten(io_lib:format("~s", [Term]))` and if that fails, then using
`lists:flatten(io_lib:format("~p", [Term]))` format.
* `str(Term)` is equivalent to `lists:flatten(io_lib:format("~p", [Term]))` for
terms that are not integers, floats, atoms, binaries and lists.
Integers, atoms, and binaries are converted to string using `*_to_list/1`
functions. Floats are converted using `float_to_list/2` where the second
argument is controled by `str:set_float_fmt/1` and `str:reset_float_fmt/0`
calls. Lists are converted to string using
`lists:flatten(io_lib:format("~s", [Term]))` and if that fails, then using
`lists:flatten(io_lib:format("~p", [Term]))` format.
* `str(Fmt, Args)` is equivalent to `lists:flatten(io_lib:format(Fmt, Args))`.
* `throw(Fmt,Args)` is equivalent to `throw(lists:flatten(io_lib:format(Fmt, Args)))`.

Two other shorthand transforms are optionally supported:

* `b2l(Binary)` is equivalent to `binary_to_list(Binary)` (enabled by giving `{d,str_b2l}`)
compilation option.
* `i2l(Integer)` is equivalent to `integer_to_list(Binary)` (enabled by giving `{d,str_i2l}`)
compilation option.
* `b2l(Binary)` is equivalent to `binary_to_list(Binary)` (enabled by giving `{d,str_b2l}`)
compilation option.
* `i2l(Integer)` is equivalent to `integer_to_list(Binary)` (enabled by giving `{d,str_i2l}`)
compilation option.

E.g.:
```
Expand Down

0 comments on commit 26d3983

Please sign in to comment.