zoukankan      html  css  js  c++  java
  • iOS开发字符串处理篇之货币格式化

    一、货币格式化

      NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init];
        currencyFormatter.numberStyle = kCFNumberFormatterDecimalStyle;
        NSString *currenctStr = [currencyFormatter stringFromNumber:[NSNumber numberWithInteger:currencyNumber]];
        return [NSString stringWithFormat:@"¥%@",currenctStr];//因为我需要的样式是¥123,456,789没有后面的.00
        /*
        NSNumberFormatterNoStyle = kCFNumberFormatterNoStyle,  // 123456789
        NSNumberFormatterDecimalStyle = kCFNumberFormatterDecimalStyle,// 123,456,789
        NSNumberFormatterCurrencyStyle = kCFNumberFormatterCurrencyStyle,//¥123,456,789.00
        NSNumberFormatterPercentStyle = kCFNumberFormatterPercentStyle, //-539,222,988%
        NSNumberFormatterScientificStyle = kCFNumberFormatterScientificStyle,//1.23456789E8
        NSNumberFormatterSpellOutStyle = kCFNumberFormatterSpellOutStyle //一亿二千三百四十五万六千七百八十九
         */
    

      

  • 相关阅读:
    121. Best Time to Buy and Sell Stock
    分页查询
    ViewPager
    SharedPreferences
    android 动画
    display~
    stringBuffer拼接有规律字符串
    修改placehosder
    this Activity.this Activity.class
    Windows基础编程SDK复习知识点
  • 原文地址:https://www.cnblogs.com/TheYouth/p/8377628.html
Copyright © 2011-2022 走看看