Option CStrings (statement)

Syntax

Option CStrings {On | Off}

Description

Turns on or off the ability to use C-style escape sequences within strings.

Comments

When Option CStrings On is in effect, the compiler treats the backslash character as an escape character when it appears within strings. An escape character is simply a special character that cannot otherwise be ordinarily typed by the computer keyboard.

 

Escape

Description

Equivalent Expression

 

\r

Carriage return

Chr$(13)

 

\n

Line feed

Chr$(10)

 

\a

Bell

Chr$(7)

 

\b

Backspace

Chr$(8)

 

\f

Form feed

Chr$(12)

 

\t

Tab

Chr$(9)

 

\v

Vertical tab

Chr$(11)

 

\0

Null

Chr$(0)

 

\"

Double quotation mark

"" or Chr$(34)

 

\\

Backslash

Chr$(92)

 

\?

Question mark

?

 

\'

Single quotation mark

'

 

\xhh

Hexadecimal number

Chr$(Val("&Hhh))

 

\ooo

Octal number

Chr$(Val("&Oooo"))

 

\anycharacter

Any character

anycharacter

 

With hexadecimal values, the Basic Control Engine stops scanning for digits when it encounters a nonhexadecimal digit or two digits, whichever comes first. Similarly, with octal values, the Basic Control Engine stops scanning when it encounters a nonoctal digit or three digits, whichever comes first.

When Option CStrings Off is in effect, then the backslash character has no special meaning. This is the default.

Example

Option CStrings On

Sub Main()
  MsgBox "They said, \"Watch out for that clump of grass!\""
  MsgBox "First line.\r\nSecond line."
  MsgBox "Char A: \x41 \r\n Char B: \x42"
End Sub

 

 

 

 

More information

O