数字处理

+ (NSString *)formatNumber:(NSString *)string

{

   NSString *result = @"--";

     if(string  && string.length > 0 && ![string isEqualToString:result]){

  if ([string floatValue] < 1000000) {

  result = [NSString  stringWithFormat:@"%.2f",[string floatValue]];
  }else {

  result = [NSString stringWithFormat:@"%d",[string intValue]];
  }

  }

 

    return result;
}

posted on 2015-07-17 17:46  哈利波特大  阅读(134)  评论(0编辑  收藏  举报