S
Simon
Hi,
I have default const strings that we use as templates to send emails, (and
multi language messages).
We also want to allow the users to format their own messages.
We have specific messages like devices name and certain settings.
I can use sprintf(...) to replace numbers or strings, but how can I replace
my own variables?
for example
const char * szMsg = "#device# was turned on at #time#";
std::string MyFormat( const char * s )
{
std::string szRet = "";
// replace all the #device# with "device number x"
// replace #time# with "12:02:36pm"
// ...and so on...
return szRet;
}
Does the standard have a way of doing search and replace?
Many thanks
Simon
I have default const strings that we use as templates to send emails, (and
multi language messages).
We also want to allow the users to format their own messages.
We have specific messages like devices name and certain settings.
I can use sprintf(...) to replace numbers or strings, but how can I replace
my own variables?
for example
const char * szMsg = "#device# was turned on at #time#";
std::string MyFormat( const char * s )
{
std::string szRet = "";
// replace all the #device# with "device number x"
// replace #time# with "12:02:36pm"
// ...and so on...
return szRet;
}
Does the standard have a way of doing search and replace?
Many thanks
Simon