NSString
zani515
这个作者很懒,什么都没留下…
展开
-
NSString去除左右空格
NSString* str = @" [d da fa] "; NSString* res = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];原创 2011-05-18 10:15:41 · 262 阅读 · 0 评论 -
sizeWithFont:constrainedToSize:lineBreakMode的使用
UIFont *font = [UIFont systemFontOfSize:12]; CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(150.0f, 1000.0f) lineBreakMode:UILineBreakModeCharacterWrap]; 获取字符串在指定的size内(宽...原创 2011-08-01 18:02:26 · 106 阅读 · 0 评论 -
componentsSeparatedByCharactersInSet使用方法
NSString *str = @"A~B^C"; NSArray *arr = [str componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"^~"]]; NSLog(@"%@", arr); 结果是:( A...原创 2012-07-11 15:19:23 · 197 阅读 · 0 评论 -
将NSString类型的浮点数用 doubleValue方法转成浮点数有偏差的解决方法
NSNumberFormatter *formatter = [[[NSNumberFormatter alloc] init] autorelease]; [formatter setNumberStyle: NSNumberFormatterDecimalStyle]; double value = [[format...原创 2013-03-20 16:05:41 · 325 阅读 · 0 评论 -
IOS7 获取字符串在指定宽度内所需的高度。
UIFont* font = [UIFontiOS7SystemFontOfSize:17weight:UI7FontWeightLight]; CGRect rect = [self.introStringboundingRectWithSize:CGSizeMake(self.view.$width-20, 1000) ...原创 2014-10-04 17:43:22 · 178 阅读 · 0 评论