Return to Snippet

Revision: 19217
at October 18, 2009 08:14 by gerhardsletten


Updated Code
NSLog(@"%@", [NSNumber numberWithInt:i]);

%@ Object

%d, %i signed int
%u     unsigned int
%f     float/double
%1.2f to controll number of decimals
%x, %X hexadecimal int
%o     octal int
%zu    size_t
%p     pointer
%e     float/double (in scientific notation)
%g     float/double (as %f or %e, depending on value)
%s     C string (bytes)
%S     C string (unichar)
%.*s   Pascal string (requires two arguments, pass pstr[0] as the first, pstr+1 as the second)
%c     character
%C     unichar

%lld   long long
%llu   unsigned long long
%Lf    long double

Revision: 19216
at October 18, 2009 08:14 by gerhardsletten


Updated Code
NSLog(@�%@�, [NSNumber numberWithInt:i]);

%@ Object

%d, %i signed int
%u     unsigned int
%f     float/double
%1.2f to controll number of decimals
%x, %X hexadecimal int
%o     octal int
%zu    size_t
%p     pointer
%e     float/double (in scientific notation)
%g     float/double (as %f or %e, depending on value)
%s     C string (bytes)
%S     C string (unichar)
%.*s   Pascal string (requires two arguments, pass pstr[0] as the first, pstr+1 as the second)
%c     character
%C     unichar

%lld   long long
%llu   unsigned long long
%Lf    long double

Revision: 19215
at October 18, 2009 08:12 by gerhardsletten


Initial Code
NSLog(@”%@”, [NSNumber numberWithInt:i]);

Initial URL


Initial Description
%@ Object

%d, %i signed int
%u     unsigned int
%f     float/double
%1.2f to controll number of decimals
%x, %X hexadecimal int
%o     octal int
%zu    size_t
%p     pointer
%e     float/double (in scientific notation)
%g     float/double (as %f or %e, depending on value)
%s     C string (bytes)
%S     C string (unichar)
%.*s   Pascal string (requires two arguments, pass pstr[0] as the first, pstr+1 as the second)
%c     character
%C     unichar

%lld   long long
%llu   unsigned long long
%Lf    long double

Initial Title
NSLog and datatype specifiers

Initial Tags


Initial Language
Objective C