Objective-C 字符串

时间:2023-12-31 11:10:08
 #import <UIKit/UIKit.h>
#import "AppDelegate.h" int main(int argc, char * argv[]) {
NSString *str = @"hello OC";
NSString *str1 = [NSString stringWithFormat:@"Number is %d",];
NSString *str2 = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://baidu.com"] encoding:NSUTF8StringEncoding error:nil]; // 同步加载网页内容 NSLog(@"%@",str2); // [str substringFromIndex:<#(NSUInteger)#>] 截取字符串 @autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
/*
在iOS9 beta1中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据。 解决办法: 在info.plist中添加
<key>NSAppTransportSecurity</key><dict>
<key>NSAllowsArbitraryLoads</key>
<true/></dict>
*/

Objective-C 字符串