Jump to content
  • 0
Sign in to follow this  
Jedzkie

How to put comma's in numbers?

Question

Hi!

 

How can i put comma's in number thru script? not a manually input a comma in number, i need a automated comma in every 3 digits.

 

for example:

 

before:

You have 1000 Cash Points.

 

After:

You have 1,000 Cash Points.

 

Regards,

Frost

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

You know, I've been wondering this too @@Frost. I'm not quite sure if that is possible, like

.@var = 100000

 

mes "You have "+.@var+" points";

It just kind of looks unprofessional without commas. I get what you mean and I'm  not sure it is possible, you might be stuck with manually having to put the " , " in place of your integers inside your scripts. :/



Now someone correct me if I'm wrong!

Share this post


Link to post
Share on other sites
  • 0

@@Frost

try this one Credit with AnnieRuru from rAthena

function	script	int__	{	.@i = getstrlen( .@str$ = getarg(0) ) -3;	.@is_negative = charat( .@str$, 0 ) == "-";	while ( .@i > .@is_negative ) {		.@str$ = insertchar( .@str$, ",", .@i );		.@i -= 3;	}	return .@str$;}

or this one from eAthena
http://www.eathena.ws/board/index.php?showtopic=170497

Share this post


Link to post
Share on other sites
  • 0

@@Frost

 

try this one Credit with AnnieRuru from rAthena

function	script	int__	{	.@i = getstrlen( .@str$ = getarg(0) ) -3;	.@is_negative = charat( .@str$, 0 ) == "-";	while ( .@i > .@is_negative ) {		.@str$ = insertchar( .@str$, ",", .@i );		.@i -= 3;	}	return .@str$;}

or this one from eAthena

http://www.eathena.ws/board/index.php?showtopic=170497

 

How do i insert it in my script?

 

sorry new i scripting :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.