1
edit
Changes
→Apple Development
|⇧ + ⌘ + 4, spacebar
|}
<br />
<h4>Objective-C</h4>
<dl style="margin-bottom:0.5em;margin-top:0.2em;line-height:1.5em;"><dd>
<i>Further information: [http://en.wikipedia.org/wiki/Objective-c Objective-C]</i>
</dl>
<h5>String Format</h5>
{| class="sortable" cellpadding="5" cellspacing="0" border="1" style="margin:0 40px 0 40px; width: 500px; text-align: left; table-layout: fixed;"
!<u>Symbol</u>
!<u>Display</u>
|----
!%@
|id
|----
!%%
|a % character
|----
!%c
|unsigned char as ASCII
|----
!%C
|unichar as Unicode
|----
!%d, %D, %i
|long
|----
!%e, %E, %f, %g, %G
|double
|----
!%hi
|short
|----
!%hu
|unsigned short
|----
!%o, %O
|unsigned long printed as octal
|----
!%p
|void *
|----
!%qi
|long long
|----
!%qu
|unsigned long long
|----
!%s
|char *
|----
!%S
|unichar *
|----
!%u, %U
|unsigned long
|----
!%x, %X
|unsigned long printed as hexadecimal
|}
<br />
<h5>String Conversion between NSString and C strings</h5>
NSString *nsstr;
const char *cstr = "Open Source!";
// Convert a C string to a NSString
nsstr = [NSString stringWithUTF8String:cstr];
// Convert a NSString to a C string
cstr = [nsstr UTF8String];
<br />
<h4>Apple Xcode v3.1.2</h4>