Classic multi-line string Asp

is it possible to get a multi-line string in classic asp (I think vbscript is a language)?

I need a multi-line string, like in python or groovy:

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

I searched a lot, but did not find a solution.

Workarounds are also welcome.

BTW: I had the same problem in javascript and it was solved in time with a function stored in a variable. This function had a multi-line comment in it, so I could get around everything except the comment using a regular expression.

Something like that:

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

And after Regex, I got a line containing:

hello
I am a multiline
string

Thanks.

Edit:

I think I missed a very important point. My client - you use something like a "preprocessor" for your scripts. It looks like this:

Dim str 
str = "<%std_text%>"

" " "<% std_text% > " , . , " vbNewline" . , " " :

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

, "" ?

- (groovy):

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

" ":

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

!

+5
6

, , . , vbNewLine vbNewLine, . VB Script & _, , , , .

+2

:

text = """"
hello world
this is some text
"""

VBScript:

text = "" & vbcrlf &_
"hello world" & vbcrlf &_
"this is some text" & vbcrlf

stringbuffer ..

with new StringBuffer
    .writeline "hello world"
    .writeline "this is some text"
    result = .as_string
end with

KISS... "" ? ....

(i18n?), , " vbcrlf ".

+6

?

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

+3

, , , , ? , ?

, . vbCrLf, vbNewLine, , . IIRC , , /, .

Dim myString : myString = "hello" & vbNewLine & "I am a multi-line" & vbNewLine & "string"

If this is the last, you just need to put <br />where you want the browser to create a new line. In this case, you may need to think about why you want it to display how you want to display it, as it may (or not) be the best way to do this.

+2
source

There are only two ways that I know of, and I have been doing this for over 10 years.

Dim x: x = "Hello" & vbNewline & "World"

or

Dim x: x = "Hello" & vbNewline & _
        "World"

I guess the hacky way too:

Dim x: x = Replace("Hello\nWorld", "\n", vbNewline)
0
source

Closest I could get:

Dim multilineStr : multilineStr = Join(Array(_
    "Begin"        , _
    "    my"       , _
    "    multiline", _
    "    string!"  , _
    "End"            _
), vbNewLine)

Dim multilineStr : multilineStr = Join(Array(_
    "Begin"        , _
    "    my"       , _
    "    multiline", _
    "    string!"  , _
    "End"            _
), "<br/>")
0
source

All Articles