absl::StrAppendFormat

Appends to a dst string given a format string, and zero or more additional arguments, returning *dst as a convenience for chaining purposes.

Synopsis

Declared in <absl/strings/str_format.h>

template<typename... Args>
std::string&
StrAppendFormat(
    std::string* dst,
    FormatSpec<Args...> const& format,
    Args const&... args);

Description

Appends nothing in case of error (but possibly alters its capacity).

Example:

std::string orig("For example PI is approximately "); std::cout << StrAppendFormat(&orig, "%12.6f", 3.14);

Return Value

A reference to *dst.

Parameters

NameDescription
dstThe string to append to.
formatThe format string.
argsThe arguments substituted into the format string.