wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/String/StrFmt

Version 5 (modified by Don Wilson, 14 years ago) ( diff )

--

StrFmt

Format a string with a format specifier and a variable number of parameters.

string StrFmt(const char* pszFmt, ...);

Parameters

  • pszFmt - character array of formatting information
  • ... - variable number of parameters to fill in formatting specifiers

Return Value

  • Returns the formatted string

Remarks

This is basically a wrapper around sprintf to provide the flexibility of formatting with some safety measures built in. If string parameters are used the ".c_str()" method will be needed to convert this to C style strings. Refer to http://www.cplusplus.com/reference/clibrary/cstdio/printf/ for formatting specifiers.

Example

int nVal = 123;
strID = "ABC";

string strMsg;
strMsg = StrFmt("Number: %d ID: %s", nVal, strID.c_str());

See Also

Note: See TracWiki for help on using the wiki.