Translating C++'s sprintf format string to C#'s string.Format
- by thebackup
I found the following C++ code (comments added myself):
// frame_name is a char array
// prefix is std::string
// k is a for loop counter
// frames is a std::vector string
sprintf(frameName, "%s_%0*s.bmp", prefix.c_str(), k, frames[k].c_str());
I then try to translate it to C#
// prefix is string
// k is a for loop counter
// frames is List<string>
string frameName = string.Format("{0}_(what goes in here?).bmp", prefix, k, frames[k]);
Basically, what would be the C# equivalent of the C++ format string "%s_%0*s.bmp"?