A constant string object is declared by encapsulating the string in double quotes (") and preceded by an @ sign. For example:
+
A constant string object is declared by encapsulating the string in double quotes (") preceded by an @ sign. For example:
<pre>
<pre>
</pre>
</pre>
−
In order to display the current value of a string object using the NSLog methods, simply reference the string using '%@' as follows:
+
In order to display the current value of a string object using NSLog, simply reference the string using '%@' as follows:
<pre>
<pre>
</pre>
</pre>
−
Even though all we are doing here is creating a constant string object, keep in mind that this is still an object. As such, it has a range of methods that we can call on it. For examples string objects have a ''length'' methods that returns the number of characters in the string. We can, therefore, call this on a constant string object:
+
Even though all we are doing here is creating a constant string object, keep in mind that this is still an object. As such, it has a range of methods that we can call on it. For example string objects have a ''length'' method that returns the number of characters in the string. We can, therefore, call this on a constant string object: