views:

92

answers:

4

I want to use the Replace function in VBScript to replacea all line breaks in a string for "\n". I come from java, so using \n inside a string means a line break.

Is there an equivalent in VBScript?

+2  A: 

I thinks its vbcrlf.

replace(s,vbcrlf,"<br />"
David
+3  A: 

For replace you can use vbCrLf:

Replace(string, vbCrLf, "")

You can also use chr(13)+chr(10)

I seem to remember in some odd cases that chr(10) comes before chr(13)

Remou
+7  A: 

This page has a table of string constants including vbCrLf

ChrisF
+4  A: 

As David and Remou pointed out, vbCrLf if you want a carriage-return-linefeed combination. Otherwise, Chr(13) and Chr(10) (although some VB-derivatives have vbCr and vbLf; VBScript may well have those, worth checking before using Chr).

T.J. Crowder
+1 Its good to get some credit for the initial answer
David