VBScript: What is the simplest way to format a string?

Replace (strFormat, "{0}", value1)

Based on your code snip, I’m guessing you believe Replace mutates strFormat directly. It doesn’t work like that; You assign the result to the original variable like this:

strFormat = Replace (strFormat, "{0}", value1)

You can also assign to another variable to store the changed results, like this:

strFormat2 = Replace (strFormat, "{0}", value1)

Leave a Comment