Format line so that I end up with =“08075”

2019-07-24 15:57发布

How many " (double quotes) do I put around this line so that I end up with ="08075" being pasted into my excel worksheet? The line is:

Response.Write vbTab & ResultSet(8,r)

I need and '=' sign with a single quote before the ResultSet(8,r) with a closing double quote after... I tried:

Response.Write vbTab & "="" & ResultSet(8,r) & """

but that didn't work, plus a couple others but that didn't work, the number of quotes thing always gets me so if someone wants to give me a general rule of thumb on this one I would really appreciate it.

标签: asp-classic
3条回答
时光不老,我们不散
2楼-- · 2019-07-24 16:44

To get a literal double quote (") inside of a string in VBScript, you need to use two double quotes (""). So for your example:

Response.Write vbTab & "=""" & ResultSet(8,r) & """"
'                      ^   ^                    ^  ^ These delimit the string
'                        ^^                      ^^  These create literal quotes
查看更多
beautiful°
3楼-- · 2019-07-24 16:53

Wouldn't you know, I just cracked it:

Response.Write vbTab & "=""" & ResultSet(8,r) & """"

Thanks, R.

查看更多
来,给爷笑一个
4楼-- · 2019-07-24 16:53

Double each quote you want to end up in the string. So what you want would be:

Response.Write vbTab & "=""" & ResultSet(8,r) & """"
查看更多
登录 后发表回答