Changes

Jump to: navigation, search

Ruby Strings - Creation and Basics

4 bytes added, 13:10, 1 December 2007
General Delimited Strings
== General Delimited Strings ==
Ruby allows you to define any character you want as a string delimiter simply by prefixing the desired character with a %. For example, we could use the ampersand to delimit our string:
<pre>
</pre>
Ruby also provide provides a few special delimited strings. %Q is the equivalent of double quote delimiters and %q is the equivalent of single quotes. %x is the equivalent of back-quote (`) delimited strings.
An easy way to embed quotes in a Ruby string is to ''escape'' them by preceding them with a backslash (\):

Navigation menu