|
Post Reply
|
Page 12> |
| Author | |
Salararius
Postmaster
Joined: 26 Sep 2011 Location: USA Status: Offline Points: 519 |
Topic: Commas In IGM NumbersPosted: 05 Oct 2012 at 05:26 |
|
30 of a total 30 for sale at ???????? at [???|???] in ???????? has been accepted by ???? [???] from ?????????? for a total of 292500.0000Gold. 80000 of a total 754000 for sale at ???????? at [???|???] in ??????? has been accepted by ??????? [???] from ???????? for a total of 80000.0000Gold. 100000 of a total 854000 for sale at ???????? at [???|???] in ??????? has been accepted by ??????? [???] from ?????? for a total of 100000.0000Gold. It's so easy to put commas in numbers and round the decimals. There's really no reason why any numbers should be in any communication without commas and rounding. It should be a common function used when outputting any number. I'm tired of staring at these emails trying to decipher the numbers. function addCommas(n, dec) { var rx = /(\d+)(\d{3})/; var decimalVal = Math.pow(10, dec); var numberStr = String(Math.round(n * decimalVal) / decimalVal); numberStr = numberStr.replace(/^\d+/, function(w) { while(rx.test(w)) w = w.replace(rx, '$1,$2'); return w; }); if (dec == 0) return numberStr; if (numberStr.indexOf(".") == -1) return numberStr + "." + String(decimalVal).substr(1); return numberStr + String(decimalVal).substr(numberStr.length - numberStr.indexOf(".")) } |
|
![]() |
|
hellion19
Forum Warrior
Joined: 01 Aug 2012 Status: Offline Points: 310 |
Posted: 05 Oct 2012 at 08:15 |
|
Would be a nice addition
|
|
![]() |
|
Albatross
Postmaster General
Joined: 11 May 2011 Status: Offline Points: 1118 |
Posted: 05 Oct 2012 at 10:32 |
|
+1, but do it everywhere... http://forum.illyriad.co.uk/forum_posts.asp?TID=2805&PID=33742&title=localized-commaformatted-numbers#33742
Edited by Albatross - 05 Oct 2012 at 10:32 |
|
![]() |
|
![]() |
|
DeathDealer89
Postmaster
Joined: 04 Jan 2012 Status: Offline Points: 944 |
Posted: 05 Oct 2012 at 17:47 |
|
I'll counter with y not just use K anytime something goes above 10k and M anytime something goes above 10M
|
|
![]() |
|
Faenix
Forum Warrior
Joined: 29 Oct 2011 Status: Offline Points: 283 |
Posted: 05 Oct 2012 at 18:13 |
You could do that .. Or String.Format("{0:n0}", 1234)
|
|
![]() |
|
Rill
Postmaster General
Player Council - Geographer Joined: 17 Jun 2011 Location: California Status: Offline Points: 6903 |
Posted: 05 Oct 2012 at 19:23 |
|
I think it should be in scientific notation -- 1.234 x 10^5
|
|
![]() |
|
dunnoob
Postmaster
Joined: 10 Dec 2011 Location: Elijal Status: Offline Points: 800 |
Posted: 05 Oct 2012 at 23:31 |
|
/* REXX */ numeric form engineering; numeric digits 5; X = 1.234E5; say X /* yields 123.4E+3 */
![]() Edited by dunnoob - 05 Oct 2012 at 23:32 |
|
![]() |
|
Albatross
Postmaster General
Joined: 11 May 2011 Status: Offline Points: 1118 |
Posted: 06 Oct 2012 at 01:47 |
|
|
![]() |
|
![]() |
|
Beardo13
New Poster
Joined: 19 Jul 2012 Status: Offline Points: 31 |
Posted: 06 Oct 2012 at 08:17 |
/me facepalm
|
|
![]() |
|
Salararius
Postmaster
Joined: 26 Sep 2011 Location: USA Status: Offline Points: 519 |
Posted: 07 Oct 2012 at 19:38 |
Um, I think that's C#, which is great if they formatted the IGM in C#. I also don't think that will give the same format. It will not format the decimals, only add commas. Which is fine, but I think four decimal places is too many. |
|
![]() |
|
Post Reply
|
Page 12> |
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |