str (etran v0.5.3)

View Source

Parse transform that implements str/2

Use {parse_transform,str} compiler's option to use this transform.

   str(Fmt, Args)     -> lists:flatten(io_lib:format(Fmt, Args))
   bin(Fmt, Args)     -> list_to_binary(io_lib:format(Fmt, Args))
   throw(Fmt, Args)   -> erlang:throw(list_to_binary(io_lib:format(Fmt, Args))
   error(Fmt, Args)   -> erlang:error(list_to_binary(io_lib:format(Fmt, Args))
   i2l(Int)           -> integer_to_list(Int)      % Enabled with compiled with
                                                   % the `{d,str_i2l}' option
   b2l(Bin)           -> binary_to_list(Bin)       % Enabled with compiled with
                                                   % the `{d,str_b2l}' option
   str(Term)          -> str:str(Term)
   bin(Term)          -> str:bin(Term)

Summary

Functions

Stringify an argument and return as binary

Stringify an argument and return as binary

Get custom float format from the process dictionary

Parse transform to be used by providing {parse_transform, str} option.

Erase custom float format from the process dictionary

Store custom float format in the process dictionary Return previously stored format. Also see float_to_list/2 http://erlang.org/doc/man/erlang.html#float_to_list-2

Stringify an argument

Stringify an argument with options passed to float_to_list/2 when the first argument is a float

Types

fmt_args/0

-type fmt_args() ::
          [{decimals, Decimals :: 0..253} | {scientific, Decimals :: 0..249} | compact | short].

Functions

bin(I)

-spec bin(term()) -> binary().

Stringify an argument and return as binary

bin(I, Opts)

-spec bin(term(), fmt_args()) -> binary().

Stringify an argument and return as binary

get_float_fmt()

Get custom float format from the process dictionary

parse_transform(AST, Opts)

Parse transform to be used by providing {parse_transform, str} option.

reset_float_fmt()

Erase custom float format from the process dictionary

set_float_fmt(Opts)

Store custom float format in the process dictionary Return previously stored format. Also see float_to_list/2 http://erlang.org/doc/man/erlang.html#float_to_list-2

str(I)

-spec str(term()) -> string().

Stringify an argument

str(I, Opts)

-spec str(term(), fmt_args()) -> string().

Stringify an argument with options passed to float_to_list/2 when the first argument is a float