objc--NSUInteger and INT 转换问题

来源:互联网 发布:数据库截断 编辑:程序博客网 时间:2024/05/21 08:03

NSMutableString *strT = [[NSMutableString alloc] initWithString:dataStr];//声明一个可变字符串数组

/*字符串长度单位是NSUInteger,因为是无符号数,比较过程中发现存在问题,因此用下面的方法将其转换成int类型的,进行比较。*/

NSLog(@"str length=%u",strT.length/2);

int myLenght = [[NSString stringWithFormat:@"%u",strT.length] intValue]/2;

0 0
原创粉丝点击