VBScript:文字列リテラル
ダブルクォーテーションで括ったものが文字列リテラルとなる。
code:hello_literal.vbs
s = "Hello, world!"
ダブルクォーテーション自体は2回連続で書くことで表現する。
VBScript における文字列リテラルのエスケープはダブルクォーテーションしかない。
バックスラッシュ\ (フォントによっては円マーク)はそのままの文字で取り扱われる。
table:escape
"" " (ダブルクォーテーション) Chr(34)
code:sample_dquote.vbs
s = "He said ""Hello, world!""."
文字列リテラルで表現できないものは Chr 関数か特定の定数を使って文字列結合することで表現する。
table:string_constant
Constant Value Description
vbCr Chr(13) Carriage return.
VbCrLf Chr(13) & Chr(10) Carriage return–linefeed combination.
vbFormFeed Chr(12) Form feed; not useful in Microsoft Windows.
vbLf Chr(10) Line feed.
vbNewLine Chr(13) & Chr(10) or Chr(10) Platform-specific newline character; whatever is appropriate for the platform.
vbNullChar Chr(0) Character having the value 0.
vbNullString String having value 0 Not the same as a zero-length string (""); used for calling external procedures.
vbTab Chr(9) Horizontal tab.
vbVerticalTab Chr(11) Vertical tab; not useful in Microsoft Windows.
code:sample.vbs
s = "Hello" & vbCrLf & "world!" & vbCrLf
vbNullString はいわゆる文字列に特化した「NULL ポインタ」と同義で、空文字列("")とは異なる。(Nothing でもない。)