What is VB.NET's newline keyword?
Actually, if you want C style escape characters:
It's not nearly as powerful as the actual C escape sequences, but provides most of the common 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 Else Res += Arr(i) End If i += 1 Loop Return Res End Function
It's not nearly as powerful as the actual C escape sequences, but provides most of the common escape characters.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement