Changes

Ruby Strings - Creation and Basics

4 bytes added, 15:08, 31 March 2009
no edit summary
</pre>
The above method creates an empty string. Alternatively a new string may be created and initialized by passing through a string as an argument to the ''new'' method:
<pre>
</pre>
Another option, if you aren't using escape characters such as new lines (\n) is to use single quote quotes to delimit a string containing double quotes and vice versa:
<pre>
</pre>
When this string is printed to it appears exactly as it was entered, together with all the new lines and tabs:
<pre>
</pre>
== Getting Information About about String Objects ==
The String object includes a number of methods that can be used to obtain information about the string. For example, we can find if a string is empty using the ''empty?'' method: