Alex Rivera | Logout

Multiline String In Classic Asp

Asked 2009-12-16T14:15:50.120
9

is there any possiblity to get multiline string in classic asp (I think vbscript is the language)?

I want a multiline string like in python or groovy:

def str = """hello I am a multiline string"""

I searched a lot but didn't find a solution.

Workarounds are welcome too.

BTW: I had in javascript the same problem and solved it back in time with a function saved in a variable. This function had a multiline comment in it so I could through everything away except the comment using regex.

Something like this:

var multilinestr = function() {
/*
hello
I am a multiline
string
*/
}

And after Regex I got a String which contains:

hello
I am a multiline
string

Thank you.

Edit:

I think I missed a very important point. My client is you using something like a "pre processor" for his scripts. It looks like this:

Dim str 
str = "<%std_text%>"

The "pre processor" exchanges "<%std_text%>" with a text which comes from a Database. But this text have breaks in it so I can't just put a '" & vbNewline ' to the end of line. This means after "pre processing" it looks like this:

Dim str 
str = "hello 
I am a multiline
string"

Is there anyway to get this "text" in a string?

If I could write something like this (groovy):

def multistr = """<%std_text%>"""

after "pre processing":

def multistr = """hello
I am a multiline
string"""

It would be great!

Edit
Report

1 Answer

3

Could you not add carriage returns to the string?

Dim myString : myString = "Line 1" & vbCrLf & "Line 2"... etc

answered 2009-12-16T14:20:26.443

Your Answer