Is there any level of support for, or an alternative to, heredoc syntax in vbscript? I have the following:
test = "an "example" string"
where the actual contents of the string (i.e. an "example" string
) is inserted via a separate technology level (pretend its similar to a macro preprocessor) and there may be no way around that. So, ideally, I'd lik开发者_运维百科e something like:
test = <<<EOL
an "example" string
EOL;
but vbscript doesn't, as far as I can tell, support heredoc syntax. Any alternatives?
@Bobby Jack: The best I can come up with is importing a file which contains all the formatting/other data you need, e.g.
Set oFS = Server.CreateObject("Scripting.FileSystemObject")
Set oF = oFS.OpenTextFile(Server.MapPath("somefile.html"), 1)
sText = oF.ReadAll
oF.Close
Set oF = Nothing
Set oFS = Nothing
And then replacing "variables" within it that are delimited by some characters, e.g.:
sText = Replace(sText, "##var1##", var1)
sText = Replace(sText, "##var2##", var2)
sText = Replace(sText, "##var10##", var10)
sText
can then be saved to another file or output to the screen.
精彩评论