title: NSNumberFormatter : Show 'k' instead of ',000' in large numbers?
body: <p>I'd like to change my large numbers from 100,000 to $100K if this is possible.</p>
  
  <p><strong>This is what I have so far:</strong></p>
  
  <pre><code>let valueFormatter = NSNumberFormatter()
  valueFormatter.locale = NSLocale.currentLocale()
  valueFormatter.numberStyle = .CurrencyStyle
  valueFormatter.maximumFractionDigits = 0
  </code></pre>
  
  <h2>My Question</h2>
  
  <p>Using NSNumberFormatter, how can I output $100K rather than $100,000?</p>
  
  <hr>
  
  <p>My original question:</p>
  
  <p><strong>This is what I have so far:</strong></p>
  
  <pre><code>self.lineChartView.leftAxis.valueFormatter = NSNumberFormatter()
  self.lineChartView.leftAxis.valueFormatter?.locale = NSLocale.currentLocale()
  self.lineChartView.leftAxis.valueFormatter?.numberStyle = .CurrencyStyle
  self.lineChartView.leftAxis.valueFormatter?.maximumFractionDigits = 0
  </code></pre>
  
  <p><strong>Which Translates to:</strong></p>
  
  <pre><code>let valueFormatter = NSNumberFormatter()
  valueFormatter.locale = NSLocale.currentLocale()
  valueFormatter.numberStyle = .CurrencyStyle
  valueFormatter.maximumFractionDigits = 0
  </code></pre>
  
  <p><strong>My output looks like this:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/68uWZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/68uWZ.png" alt="enter image description here"></a></p>
  
  <h2>My Question</h2>
  
  <p>Using NSNumberFormatter, how can I output $100K rather than $100,000?</p>
  
  <hr>
  
  <p><strong>update:</strong></p>
  
  <p>I wanted to provide context as to whats going on, watch comments.</p>
  
  <pre><code>func setDollarsData(months: [String], range: Double) {
  
      var dataSets: [LineChartDataSet] = [LineChartDataSet]()
  
      var yVals: [ChartDataEntry] = [ChartDataEntry]()
      for var i = 0; i &lt; months.count; i++ {
          // I'm adding my values here in value:, value takes a Double
          yVals.append(ChartDataEntry(value: county[userFavs[0]]![i], xIndex: i))
      }
  
      let set1: LineChartDataSet = LineChartDataSet(yVals: yVals, label: self.userFavs[0])
      set1.axisDependency = .Left
                  set1.setColor(UIColor.redColor().colorWithAlphaComponent(0.5))
       set1.setCircleColor(UIColor.redColor())
       set1.lineWidth = 2.0
       set1.circleRadius = 6.0
       set1.fillAlpha = 65 / 255.0
  
       dataSets.append(set1)
  
      let data: LineChartData = LineChartData(xVals: months, dataSets: dataSets)
      data.setValueTextColor(UIColor.whiteColor())
  
      // this is where I set the number formatter
      self.lineChartView.gridBackgroundColor = UIColor.darkGrayColor()
      self.lineChartView.leftAxis.startAtZeroEnabled = false
      self.lineChartView.leftAxis.valueFormatter = NSNumberFormatter()
      self.lineChartView.leftAxis.valueFormatter?.locale = NSLocale.currentLocale()
      self.lineChartView.leftAxis.valueFormatter?.numberStyle = .CurrencyStyle
      self.lineChartView.leftAxis.valueFormatter?.maximumFractionDigits = 0
  
      // set it to the chart // END OF THE LINE
      self.lineChartView.data = data // outputs to my chart
  
      }
  </code></pre>
  
  <p>As you can see, once I dump the numbers into yVals, I lose access to them so those extensions will only work if I hack into the framework.</p>