# How to format MX number from 2000000 into readable 2,000,000?

**URL:** https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565
**Category:** Uncategorized
**Created:** [April 18, 2003, 2:36am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565 "2003-04-18T02:36:07Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![igx](https://avatars.discourse-cdn.com/v4/letter/i/7cd45c/32.png) [@igx](https://forum.kirupa.com/u/igx)
#### Post date: [April 18, 2003, 2:36am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/1 "2003-04-18T02:36:07Z")

</div>

Hi, my name is IGX and I have question :

Is there anyway in Flash to format displayed number with comma or decimal point for example : 2000000 should be displayed as 2,000,000 for more ease to our eyes, is there any available way ?

Thank you.

- IGX  
😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 18, 2003, 3:33am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/2 "2003-04-18T03:33:46Z")

</div>

```auto
function fDisplayNumber(nNumber) {
	nNumber += "", nTemp = (nNumber.length)%3;
	if (nTemp>0) {
		var sTemp = nNumber.substr(0, (nNumber.length)%3)+",";
	} else {
		var sTemp = "";
	}
	for (var ii = nTemp, jj = 0; ii<nNumber.length; ii++, jj++) {
		if (jj%3 == 0) {
			sTemp += nNumber.substr(ii, 3)+",";
		}
	}
	sTemp = sTemp.substr(0, sTemp.length-1);
	return (sTemp);
}

```

that should cover the commas for you.  
Jeremy

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 18, 2003, 7:28am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/3 "2003-04-18T07:28:27Z")

</div>

Hi friend thank you for your help, but there is small small error said Flash MX, like the “;” and “{” which I dont understand where to place…

mmmmm, please help me, I’m not good in this…

Thank you

- IGX / Akiko:chinaman:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 18, 2003, 9:06am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/4 "2003-04-18T09:06:40Z")

</div>

```auto
fNum = function(n, s) {
	var n = n.toString(), l = n.length-1, i, t;
	for (i=0; i<=l; i++) {
		t += n.charAt(i);
		if (i<l && (l-i)%3 == 0) t += s;
	}
	return t;
}
trace(fNum(2000000, ","));

```

😉 =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 18, 2003, 3:09pm UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/5 "2003-04-18T15:09:50Z")

</div>

KAX AND SINFINITI IS THE GREAT.

IT’S WORKING NOW - IM SO HAPPPPPYYYY !!! :phil:

SINFINITI GAVE ME THE START

AND KAX PERFECTS IT ALRIGHT

THANK YOU MY E-FRIENDS !!!

LOVE YOU ALL

PEACE

:rambo:

- Love Akiko - South Korea

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 18, 2003, 4:22pm UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/6 "2003-04-18T16:22:41Z")

</div>

glad you liked it. 😉 =)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 19, 2003, 12:36am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/7 "2003-04-19T00:36:06Z")

</div>

Of Course Kax

🔗 🥚🥚🥚😛

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 19, 2003, 1:45am UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/8 "2003-04-19T01:45:10Z")

</div>

nice one kax, i prefer your function to mine definitely!  
🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 19, 2003, 5:26pm UTC](https://forum.kirupa.com/t/how-to-format-mx-number-from-2000000-into-readable-2-000-000/18565/9 "2003-04-19T17:26:48Z")

</div>

scuse me…can anyone explain abit about the script…coz im not that good at it…and i want to learn how…thanks…
