Module mochifmt

String Formatting for Erlang, inspired by Python 2.6 (PEP 3101).

Copyright © 2008 Mochi Media, Inc.

Authors: Bob Ippolito (bob@mochimedia.com).

Description

String Formatting for Erlang, inspired by Python 2.6 (PEP 3101).

Function Index

bformat/2Format Args with Format and return a binary().
bformat/3Format Args with Format using Module and return a binary().
convert_field/2Process Arg according to the given explicit conversion specifier.
f/2Format Args with Format and return a string().
f/3Format Args with Format using Module and return a string().
format/2Format Args with Format.
format/3Format Args with Format using Module.
format_field/2Format Arg with Format.
format_field/3Format Arg with Format.
get_field/2Consecutively call get_value/2 on parts of Key delimited by ".", replacing Args with the result of the previous get_value.
get_field/3Consecutively call Module:get_value/2 on parts of Key delimited by ".", replacing Args with the result of the previous get_value.
get_value/2Get the Key from Args.
test/0Run tests.
tokenize/1Tokenize a format string into mochifmt's internal format.

Function Details

bformat/2

bformat(Format::string(), Args) -> binary()

Format Args with Format and return a binary().

bformat/3

bformat(Format::string(), Args, Module) -> binary()

Format Args with Format using Module and return a binary().

convert_field/2

convert_field(Arg, Conversion::conversion()) -> term()

Process Arg according to the given explicit conversion specifier.

f/2

f(Format::string(), Args) -> string()

Format Args with Format and return a string().

f/3

f(Format::string(), Args, Module) -> string()

Format Args with Format using Module and return a string().

format/2

format(Format::string(), Args) -> iolist()

Format Args with Format.

format/3

format(Format::string(), Args, Module) -> iolist()

Format Args with Format using Module.

format_field/2

format_field(Arg, Format) -> iolist()

Format Arg with Format.

format_field/3

format_field(Arg, Format, Module::_Module) -> iolist()

Format Arg with Format.

get_field/2

get_field(Key::string(), Args) -> term()

Consecutively call get_value/2 on parts of Key delimited by ".", replacing Args with the result of the previous get_value. This is used to implement formats such as {0.0}.

get_field/3

get_field(Key::string(), Args, Module) -> term()

Consecutively call Module:get_value/2 on parts of Key delimited by ".", replacing Args with the result of the previous get_value. This is used to implement formats such as {0.0}.

get_value/2

get_value(Key::string(), Args::args()) -> term()

Get the Key from Args. If Args is a tuple then convert Key to an integer and get element(1 + Key, Args). If Args is a list and Key can be parsed as an integer then use lists:nth(1 + Key, Args), otherwise try and look for Key in Args as a proplist, converting Key to an atom or binary if necessary.

test/0

test() -> ok

Run tests.

tokenize/1

tokenize(S::string()) -> tokens()

Tokenize a format string into mochifmt's internal format.


Generated by EDoc, Aug 8 2008, 22:08:25.