| 1 | = StrFmtLen = |
| 2 | Format a string with a format specifier and a variable number of parameters. |
| 3 | |
| 4 | {{{ |
| 5 | string StrFmtLen(int nLen, const char* pszFmt, ...); |
| 6 | }}} |
| 7 | |
| 8 | == Parameters == |
| 9 | |
| 10 | * nLen - length to make the generated output string |
| 11 | * pszFmt - character array of formatting information |
| 12 | * ... - variable number of parameters to fill in formatting specifiers |
| 13 | |
| 14 | == Return Value == |
| 15 | |
| 16 | * Returns the formatted string |
| 17 | |
| 18 | == Remarks == |
| 19 | |
| 20 | This is similar to StrFmt but with the added length parameter. If the output string would be shorter than the specified length the output is padded with spaces to the right to make the string the desired length. If the output string would be longer than the specified length the output is truncated. 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. |
| 21 | |
| 22 | == Example == |
| 23 | |
| 24 | {{{ |
| 25 | int nVal = 123; |
| 26 | string strID = "ABC"; |
| 27 | |
| 28 | string strMsg; |
| 29 | strMsg = StrFmtLen(40, "Number: %d ID: %s", nVal, strID.c_str()); |
| 30 | }}} |
| 31 | |
| 32 | |
| 33 | == See Also == |
| 34 | |
| 35 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/String/StrFmt StrFmt] |
| 36 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/String/StrToInt StrToInt] |
| 37 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/String/StrToFloat StrToFloat] |