id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

separateThousands


Given a number as a string, introduce commas to separate thousands. The number may contain an optional minus sign, and an optional decimal part. There will not be any superfluous leading zeroes.


separateThousands("1000") → "1,000"
separateThousands("-12345") → "-12,345"
separateThousands("-1234567890.1234567890") → "-1,234,567,890.1234567890"

...Save, Compile, Run (ctrl-enter)

String separateThousands(String s) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 800

Copyright Nick Parlante 2017 - privacy