• Advertisement
Sign in to follow this  

What is VB.NET's newline keyword?

This topic is 4788 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Actually, if you want C style escape characters:

'simple iterative string processor to convert C style escape sequences (written by Promit Roy)
Public Function EscapeString( Text As String ) As String
Dim Res As String
Dim Arr As Char()
Dim i As Integer

Arr = Text.ToCharArray()

i = 0
Do While i < Arr.Length()
If Arr(i) = "\" Then
'process it
i += 1
Select Case Arr(i)
Case "t"
Res += vbTab
Case "r"
Res += vbCr
Case "n"
Res += vbLf
Case "v"
Res += vbVerticalTab
Case "f"
Res += vbFormFeed
Case "'"
Res += "'"
Case """" 'double quote
Res += """"
Case "b"
Res += vbBack
Case "0"
Res += vbNullChar
Case "a"
Res += Chr( &H7 )
Case "\"
Res += "\"
Case Else
'don't do anything with res
End Select
Res += Arr(i)
End If

i += 1

Return Res
End Function

It's not nearly as powerful as the actual C escape sequences, but provides most of the common escape characters.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement