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

試著忘記壹切 提交于 2019-12-11 10:39:23

问题


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.


回答1:


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



回答2:


Wouldn't you know, I just cracked it:

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

Thanks, R.




回答3:


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

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


来源:https://stackoverflow.com/questions/1197725/format-line-so-that-i-end-up-with-08075

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!