经典Asp中的多行字符串

Oem*_*erA 7 string asp-classic

是否有可能在经典asp中获取多行字符串(我认为vbscript是语言)?

我想要一个像python或groovy中的多行字符串:

def str ="""你好我是一个多线字符串"""

我搜索了很多,但没有找到解决方案.

也欢迎变通方法.

顺便说一句:我在javascript中遇到了同样的问题,并使用保存在变量中的函数及时解决了问题.这个函数有一个多行注释,所以除了使用正则表达式的注释,我可以通过一切.

像这样的东西:

var multilinestr = function() {
/*
hello
I am a multiline
string
*/
}
Run Code Online (Sandbox Code Playgroud)

在Regex之后我得到一个包含以下内容的字符串:

hello
I am a multiline
string
Run Code Online (Sandbox Code Playgroud)

谢谢.

编辑:

我想我错过了一个非常重要的观点.我的客户是你为他的脚本使用类似"预处理器"的东西.它看起来像这样:

Dim str 
str = "<%std_text%>"
Run Code Online (Sandbox Code Playgroud)

"预处理器"使用来自数据库的文本交换"<%std_text%>".但是这个文本有中断,所以我不能只在行尾添加'"&vbNewline".这意味着在"预处理"后它看起来像这样:

Dim str 
str = "hello 
I am a multiline
string"
Run Code Online (Sandbox Code Playgroud)

反正有没有在字符串中得到这个"文本"?

如果我可以写这样的东西(groovy):

def multistr = """<%std_text%>"""
Run Code Online (Sandbox Code Playgroud)

在"预处理"之后:

def multistr = """hello
I am a multiline
string"""
Run Code Online (Sandbox Code Playgroud)

这会很棒!

Joo*_*ker 7

蟒蛇:

text = """"
hello world
this is some text
"""
Run Code Online (Sandbox Code Playgroud)

VBScript中:

text = "" & vbcrlf &_
"hello world" & vbcrlf &_
"this is some text" & vbcrlf
Run Code Online (Sandbox Code Playgroud)

你也可以写一个自定义的stringbuffer类等.

with new StringBuffer
    .writeline "hello world"
    .writeline "this is some text"
    result = .as_string
end with
Run Code Online (Sandbox Code Playgroud)

Just KISS ...我的意思是脚本语言的'预处理器'?这听起来不太好......

如果你真的需要使用预处理器(i18n?),你需要修改它,以便用"&vbcrlf&"替换所有换行符.


Sha*_*ard 2

不幸的是,据我所知,您将无法按原样使用它。您需要修改预处理器以将vbNewLine' 替换为实际vbNewLine变量而不是真正的换行符。在 VB 脚本中,如果不使用它,就无法在多行上连接字符串,& _这需要您在每行上这样做之前关闭字符串,这对于此设置来说似乎是不可能的。