zoukankan      html  css  js  c++  java
  • NSMutableString 的使用例子

    NSString * priceString = [dict objectForKey:@"exhibition"];

        float price = [priceString floatValue];

        

        // 搜索文字

        NSString * str = [NSString stringWithFormat:@"¥%.2f万",price];

        NSString *tempStr = @"\d{1,}";

        

        NSMutableArray *results = [NSMutableArray array];

        NSRange searchRange = NSMakeRange(0, [str length]);

        NSRange range;

        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:str];

        while ((range = [str rangeOfString:tempStr options:NSRegularExpressionSearch range:searchRange]).location != NSNotFound)

        {

            [results addObject:[NSValue valueWithRange:range]];

            searchRange = NSMakeRange(NSMaxRange(range), [str length] - NSMaxRange(range));

            [string addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:range];

        }

        cell.priceLable.attributedText = string;

  • 相关阅读:
    COGS 859. 数列
    9.7noip模拟试题
    hash练习
    9.6noip模拟试题
    9.5noip模拟试题
    poj 2117 Electricity
    洛谷P1993 小 K 的农场(查分约束)
    9.2noip模拟试题
    洛谷 P1273 有线电视网(dp)
    面试题收集
  • 原文地址:https://www.cnblogs.com/angongIT/p/4514643.html
Copyright © 2011-2022 走看看