dot-strformat: Format a string like python's format method

Description Usage Arguments Examples

Description

Given a string with environment variables (encoded like ${VAR} or $VAR), and other variables (encoded like {VAR}) this function will substitute both of these and return the formatted string, like the Python str.format() method. Other variables are populated from a list of arguments. Additionally, if the string is a non-absolute path, it will be expanded.

Usage

1
.strformat(string, args, parent = NULL)

Arguments

string

String with variables encoded

args

named list of arguments to use to populate the string

parent

a directory that will be used to make the path absolute

Examples

1
2
.strformat("~/{VAR1}{VAR2}_file", list(VAR1="hi", VAR2="hello"))
.strformat("$HOME/{VAR1}{VAR2}_file", list(VAR1="hi", VAR2="hello"))

pepr documentation built on Jan. 13, 2021, 3:50 p.m.