字符串操做:html
http://www.myexception.cn/mobile/455287.htmlspa
1,判斷兩字符串是否相同orm
NSString *str1 = @"hello pepe";
NSString *str2=[NSString stringWithFormat:@"hello %s","pepe"];
if([str1 isEqualToString:str2]){
NSLog(@"相同");
}
else{
NSLog(@"不一樣");
}
2,浮點型運算
CGRect screenRect=[UIScreenmainScreen].bounds;htm
CGFloat widthf= (screenRect.size.height-self.adView.frame.size.width)/2;字符串
CGFloat heighf=screenRect.size.width-self.adView.frame.size.height-50.0f;string