Format an Integer with Thousands Separators

Asked at Hudson River Trading · Coding Questions · Difficulty: Easy · Last asked Nov 11, 2026

Convert an integer to its decimal text with a comma after every group of three digits, counted from the right, the way large numbers are written in everyday reports. For example, `1234` becomes `"1,234"` and `-1234567` becomes `"-1,234,567"`.

Loading the problem…