在Visual Basic中,
我写了下面的代码但是我在打印字符串格式时遇到了问题 虽然它是整数类型。我试图通过不重复相同来节省时间 超过30个数字的东西。
Dim line As Integer
line = 0
Sub DisplayModule(page As Integer, line As Integer)
maxline = 100
For line = 0 To maxline
Print #page, Spc(6); "Display in String"
Print #page, Spc(8); "{"
Print #page, Spc(10); """line"""
Print #page, Spc(8); "}"
Print #page, Spc(8); "next"
Next
End Sub
问题 - 显示:
Display in String
{
line
}
"next line please"
{
line
}
.
.
我想用""这样显示:
Display in String
{
"0"
}
"next line please"
{
"1"
}
.
.
我在SO上找不到类似的东西。 谢谢你的帮助。
答案 0 :(得分:5)
试试这个
Print #page, Spc(10); chr(34) & line & chr(34)
答案 1 :(得分:2)
尝试
Dim line As Integer
line = 0
Sub DisplayModule(page As Integer, line As Integer)
maxline = 100
For line = 0 To maxline
Print #page, Spc(6); "Display in String"
Print #page, Spc(8); "{"
Print #page, Spc(10); """" & line & """"
Print #page, Spc(8); "}"
Print #page, Spc(8); "next"
Next
End Sub