Display Number as Currency (With Commas)

Get help using Construct 2

Post » Sat May 30, 2015 3:28 pm

BTW that capx above drops framerate from 60 to 14. I think because of the rapid looping it does to add commas.
Check out my games on Google Play:

BEAST ATTACK (500,000+ downloads!)

ASTROJUMP
B
34
S
8
G
1
Posts: 398
Reputation: 3,499

Post » Thu Aug 06, 2015 10:41 am

Message: aJamDonut can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
May not be relevant anymore, and may not be very good practice but I did this using string functions and created a function out of it. Seems to perform extremely well. I have this on my site, if you could recommend somewhere else to host it that would be great.

http://www.codersonline.net/C2/NumberFormat.zip
B
11
S
2
Posts: 87
Reputation: 817

Post » Sun Nov 08, 2015 6:53 am

Message: aronduby can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Figured I would share what I wound up with after looking into it a bit more. I'm not sure how it performs compared to the others, but it's working well for my use I guess.I have a one-liner javascript call that I use when I need to do this for websites, so I used the Construct Browser.ExecJS to it.

https://dl.dropboxusercontent.com/u/71308871/c2-formatnumber/FormatNumber.caproj

Code: Select all
Browser.ExecJS("parseInt(" & Function.Param(0) & ", 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,').replace('.00','');")


The regex in there requires a decimal, hence the toFixed. My usage is usually with whole numbers so I remove the addition of the decimal points at the end with the additional replace('.00','') call.
B
5
S
1
Posts: 7
Reputation: 478

Post » Thu Nov 17, 2016 3:41 pm

Hi guys, I´m not sure if this is a good place to ask, but does anyone know a good way to show 1.5 k gold intead of 1500 gold? And change abbreviation as the number goes higher? Also I don´t know exactly how to search this on google, I searched number abbreviation and found this tread.Thanks!
B
8
S
1
Posts: 20
Reputation: 597

Previous

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, mallorcaredes, Matthew de and 2 guests