Top

Commas


mIRC Code
+ 0 likes
Please Register to submit score.
Average Score  4.4
Scores Submitted  7
Date Added  Jun 08, 2005
Last Updated  Sep 28, 2007
Tags  alias  comma 
  Bookmark and Share

Introduction

returns a number formatted with commas representing the standard thousands, millions, billions separations in a number

usage: /comma number or $comma number

Updated to account for updated knowledge. Also allows for decimals in the number.


Grab the Code

Comments

  (13)  RSS
RusselB
Comments: 98
 
mIRC Snippet:  Commas
Posted on Jun 10, 2005 1:49 am
hmm...3 scores, and fairly low, I\'d think, based on the average, but no comments as to why a person scored it as they did.
QuickStep
Comments: 123
 
mIRC Snippet:  Commas
Posted on Jun 10, 2005 7:04 pm
general nice code, a few tips though: the variable %b isnt needed, you can just paste that into %c. Also (and this is something to keep in mind) dont double VAR a variable (this also means, dont use VAR in a loop). declare all the vars in the beginning like:
var %comma = $1, %c
and dont use any more var commands

anyway good work
QuickStep
Comments: 123
 
mIRC Snippet:  Commas
Posted on Jun 10, 2005 7:06 pm
meaning this is the way to go
alias comma {
var %comma = $1, %c
while %comma {
%c = $+($right(%comma,3),$chr(44),%c)
%comma = $left(%comma,-3)
}
return $left(%c,-1)
}
Stealth
Comments: 11
 
mIRC Snippet:  Commas
Posted on Jun 11, 2005 10:08 am
nice script
bearruler
Comments: 24
 
mIRC Snippet:  Commas
Posted on Jun 14, 2005 7:23 pm
Its a great script, but i just found this:
$bytes(NUMBER,b) does the same this with no hassle =P
I spent hours making my own, when $bytes(100000000000,b) gives me 100,000,000,000. Nice script, but with the $bytes, its unnecessary


Bear
xDaeMoN
Comments: 696
 
mIRC Snippet:  Commas
Posted on Jun 15, 2005 1:55 am
Yes it does put commas in it but not if the number has decimals.
FiberOPtics
Comments: 28
 
mIRC Snippet:  Commas
Posted on Jan 4, 2006 8:00 pm
There is an error in the description, where it says it works with atleast 50 numbers. Try this:

//echo -a $bytes(99999999999999999,b)

Result: 100,000,000,000,000,000

$bytes has trouble with rounding at 16 digits, and over 17 it start screwing up severly.

Try:

//echo -a $bytes(10000000000000000000000000,b)

Result:

10,000,000,000,000,001,000,000,000

See that 001 in the forth to last trio of digits?

That\'s why I made that $comma identifier, it gives support for an unlimited amount of numbers, as long as it\'s within the string too long limit.
FiberOPtics
Comments: 28
 
mIRC Snippet:  Commas
Posted on Jan 4, 2006 8:19 pm
bearruler, try these:

$bytes(0.5,b) -> 1
$bytes(-100,b) -> -,100
$bytes(10000000.1234,b) -> 10,000,000
$bytes(99999999999999999,b) -> 100,000,000,000,000,000

You were saying?
RusselB
Comments: 98
 
mIRC Snippet:  Commas
Posted on Jan 7, 2006 5:41 pm
Ooops..Nice catch FibreOptics...When I changed the code, I forgot to change the description
Scakk
Comments: 218
 
mIRC Snippet:  Commas
Posted on Sep 28, 2007 2:58 pm
First there was an error when using it to sart with. There was a \" ) \" missing.

alias comma {
$iif($1 !isnum,echo -a Number required,$iif($isid,return,echo -a)) $+($bytes($int($1),b),$calc($1 - $int($1)))
}

When I added the missing \" ) \" it did not work right. It added a \" 0 \" to the end of every number. Examples below.

/comma 5 -> 50
/comma 50 -> 500
/comma 500 -> 5000
/comma 5000 -> 5,0000
Scakk
Comments: 218
 
mIRC Snippet:  Commas
Posted on Sep 28, 2007 3:04 pm
Forgot code tags *_*

Code:
alias comma {
$iif($1 !isnum,echo -a Number required,$iif($isid,return,echo -a)) $+($bytes($int($1),b),$calc($1 - $int($1)))
}
RusselB
Comments: 98
 
mIRC Snippet:  Commas
Posted on Sep 28, 2007 9:14 pm
Thanks Scakk for catching the missing bracket.
Regarding the extra 0, that\'s due to the mis-placement of the bracket that was missing. My code has been updated.
Scakk
Comments: 218
 
mIRC Snippet:  Commas
Posted on Sep 28, 2007 10:08 pm
I am still getting the same error with the updated code.

Please Register or Login to start posting comments.
Bottom