I want to convert a number into a string representation with a format similar to Stack Overflow reputation display.
e.g.
- 999 == ‘999’
- 1000 == ‘1,000’
- 9999 == ‘9,999’
- 10000 == ’10k’
- 10100 == ‘10.1k’
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Another approach that produces exactly the desired output:
Check the output results here.