Search code examples
asp-classicvbscriptline-breaks

ASP Line-breaks - \n?


I have been searching for a way to insert linebreaks in my code for when I view my source. I am not looking for <br />

Something like the PHP equiv to \n

Any ideas on how to do this in ASP? I will be placing this inside a string.


Solution

  • There's no way to do it inside a string. You will have to append vbCrLf like so:

    Response.Write "hello" & vbCrLf & "world"
    

    If you want to include it in the string, you could do a replace after like so:

    output = "hello\nworld"
    output = Replace(output, "\n", vbCrLf)
    Response.Write output