pformat: pformat: brings Python-inspired string interpolation and...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

blablabla

Perfoms string formatting and interpolation through a format specification

Usage

1
pformat(format_string, ...)

Arguments

format_string

a format string (See details for specification) or a pformat.compiled object returned from pformat_parse()

Details

Numbered fields start from 1 (not from 0, as in Python.)

Non-named fields (manually or automatically numbered) are evaluated only over the list of arguments passed. You can't write expressions involving non-named fields. In Python, you can write "{0.real}".format(1+2j) and it will return a string with the real part of the number. You can't do this here, it's a design choice. Allowing it would imply limiting the kind of expressions one could use as a field, and expressions surely provide more power than numbered fields.

On placeholders, pformat looks for names first on keyword arguments, then as a member of the with argument object, and only then at the caller's environment.

Value

returns a 'character' vector with the output

Author(s)

Maintainer: Luiz Rodrigo de Souza me@lurodrigo.com [copyright holder]

See Also

Useful links:

Examples

1
2
3
4
5
pformat("{} {}", "one", "two")

pformat("{2} {1}", "one", "two")

pformat("Name: {}; Age: {}", c("Abby", "Bob", "Carl"), 22:24)

lurodrigo/pformat documentation built on May 21, 2019, 8:58 a.m.