-1

I would like to convert a big Integer (over 1 Thousand) to a String with 'K' at the end like in Instagram: Example:

rmaddy
  • 307,833
  • 40
  • 508
  • 550
profidash_98
  • 254
  • 2
  • 3
  • 15
  • Look into the `NSByteCountFormatter` class. Much easier than all of the links you've been given. – rmaddy Aug 13 '14 at 16:22

1 Answers1

2
NSString *intWithK = myint >= 1000 ? [NSString stringWithFormat:@"%dk", myint / 1000] : [NSString stringWithFormat:@"%d", myint]

Should work :)

I your integer (I called it myint) is greater or equal to 1000 it'll divide it by 1000 and add "k", but won't do anything if it's smaller

KIDdAe
  • 2,643
  • 2
  • 21
  • 28