String quoted = "This one has \"quotes\"";
println(quoted); // This one has "quotes"
]]></code>
</example>
<description><![CDATA[
A string is a sequence of characters. The class <b>String</b> includes methods for examining individual characters, comparing strings, searching strings, extracting parts of strings, and for converting an entire string uppercase and lowercase. Strings are always defined inside double quotes (<b>"Abc"</b>), and characters are always defined inside single quotes (<b>'A'</b>).<br />
<br />
To compare the contents of two Strings, use the <b>equals()</b> method, as in <b>if (a.equals(b))</b>, instead of <b>if (a == b)</b>. A String is an Object, so comparing them with the <b>==</b> operator only compares whether both Strings are stored in the same memory location. Using the <b>equals()</b> method will ensure that the actual contents are compared. (The <a href="https://github.com/processing/processing/wiki/Troubleshooting#why-dont-these-strings-equal">troubleshooting</a> reference has a longer explanation.)<br />
<br />
Because a String is defined between double quotation marks, to include such marks within the String itself you must use the <b>\</b> (backslash) character. (See the third example above.) This is known as an <em>escape sequence</em>. Other escape sequences include <b>\t</b> for the tab character and <b>\n</b> for new line. Because backslash is the escape character, to include a single backslash within a String, you must use two consecutive backslashes, as in: <b>\\</b><br />
<br />
There are more string methods than those linked from this page. Additional documentation is located online in the <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html">official Java documentation</a>.
]]></description>
<syntax></syntax>
<method>
<mname>charAt()</mname>
<mdescription>Returns the character at the specified index</mdescription>
</method>
<method>
<mname>equals()</mname>
<mdescription>Compares a string to a specified object</mdescription>
</method>
<method>
<mname>indexOf()</mname>
<mdescription>Returns the index value of the first occurrence of a substring within the input string</mdescription>
</method>
<method>
<mname>length()</mname>
<mdescription>Returns the number of characters in the input string</mdescription>
</method>
<method>
<mname>substring()</mname>
<mdescription>Returns a new string that is part of the input string</mdescription>
</method>
<method>
<mname>toLowerCase()</mname>
<mdescription>Converts all the characters to lower case</mdescription>
</method>
<method>
<mname>toUpperCase()</mname>
<mdescription>Converts all the characters to upper case</mdescription>
</method>
<constructor>
String(<c>data</c>)
String(<c>data</c>, <c>offset</c>, <c>length</c>)
</constructor>
<cparameter>
<clabel>data</clabel>
<cdescription>byte[] or char[]: either an array of bytes to be decoded into characters, or an array of characters to be combined into a string</cdescription>
</cparameter>
<cparameter>
<clabel>offset</clabel>
<cdescription>int: index of the first character</cdescription>
</cparameter>
<cparameter>
<clabel>length</clabel>
<cdescription>int: number of characters</cdescription>