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 //一亿二千三百四十五万六千七百八十九
         */
    

      

  • 相关阅读:
    xiaota-banzhuren-login.vue-重置密码
    xiaota-banzhuren-login.vue
    xiaota-global-index
    xiaota-router-index
    tab表格嵌套tab表格
    xiaota-selectarr
    xiaota-getlunardate
    xiaota-format
    xitaota-DataTime
    xiaota-axioslmport
  • 原文地址:https://www.cnblogs.com/TheYouth/p/8377628.html
Copyright © 2011-2022 走看看