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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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