Please post a few numbers as an example of the format you are looking for.
The solution pointed to by @José J. Aguilar takes these issues into account. Now if you also want to display the appropriate currency symbol, then the article linked to in the provided solution gives the appropriate information.(Not all regions separate thousands with a comma. So if your app targets more than the users that do that, you might want to use a smarter solution.)