path: root/doc
diff options
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-16 04:24:31 (GMT)
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-16 04:24:31 (GMT)
commit35947f6d42705b8f37313a68b03f2f5b846edd6a (patch)
tree62dae4b48c2b4851c9cffdd1853155b1a15e83f7 /doc
parent06ca0b67f48839cc682e194512d69324d2965ddc (diff)
* doc/syntax/literals.rdoc (Strings): mention about ?a literal.
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc')
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
index ec37fe3..2dac68b 100644
--- a/doc/syntax/literals.rdoc
+++ b/doc/syntax/literals.rdoc
@@ -124,6 +124,23 @@ be concatenated as long as a percent-string is not last.
%q{a} 'b' "c" #=> "abc"
"a" 'b' %q{c} #=> NameError: uninitialized constant q
+One more way of writing strings is using <tt>?</tt>:
+ ?a #=> "a"
+Basically only one character can be placed after <tt>?</tt>:
+ ?abc #=> SyntaxError
+Exceptionally, <tt>\C-</tt>, <tt>\M-</tt> and their combination are allowed
+before a character. They means "control", "meta" and "control-meta"
+ ?\C-a #=> "\x01"
+ ?\M-a #=> "\xE1"
+ ?\M-\C-a #=> "\x81"
+ ?\C-\A-a #=> "\x81", same as above
=== Here Documents
If you are writing a large block of text you may use a "here document" or