Object-c 语言

时间:2023-03-09 16:14:57
Object-c 语言

字符串操作:

http://www.myexception.cn/mobile/455287.html

1,判断两字符串是否相同

NSString *str1 = @"hello pepe";   
NSString *str2=[NSString stringWithFormat:@"hello %s","pepe"];
if([str1 isEqualToString:str2]){
NSLog(@"相同");
}
else{
NSLog(@"不同");
} 2,浮点型运算

CGRect screenRect=[UIScreenmainScreen].bounds;

CGFloat widthf= (screenRect.size.height-self.adView.frame.size.width)/2;

CGFloat heighf=screenRect.size.width-self.adView.frame.size.height-50.0f;