View Source str (etran v0.5.2)

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)

Link to this section 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

Link to this section Types

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

Link to this section Functions

-spec bin(term()) -> binary().
Stringify an argument and return as binary
-spec bin(term(), fmt_args()) -> binary().
Stringify an argument and return as binary
Get custom float format from the process dictionary
Link to this function

parse_transform(AST, Opts)

View Source
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
-spec str(term()) -> string().
Stringify an argument
-spec str(term(), fmt_args()) -> string().
Stringify an argument with options passed to float_to_list/2 when the first argument is a float