Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
string type cast
//gcc 4.8.4 #import <Foundation/Foundation.h> int main(void) { NSString *year = @"2012"; //it will return 0 or 1 if true than 1 BOOL asBool = [year boolValue]; NSLog(@"%d",asBool); // in int int asInt = [year intValue]; NSLog(@"%d",asInt); //in NSInteger //You want to use %zd for signed, %tu for unsigned, and %tx for hex. NSInteger asInteger = [year integerValue]; NSLog(@"%zd",asInteger); // IN LONG //You must use %ld to print a long int, and %lld to print a long long int. long long asongLong = [year longLongValue]; NSLog(@"%ld",asongLong); // in float //Put .2(ant integer) between % and f for particular point float asFloat = [year floatValue]; NSLog(@"%.2f",asFloat); // in double double asDouble = [year doubleValue]; NSLog(@"%lf",asDouble); }
run
|
edit
|
history
|
help
0
string search
string mutable
02 Mostrar valor de variable entera
NSSet ex
emp class
Uso de else if
book
muteble
01 Hola mundo
objective c fibonanci