Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Sun Apr 07, 2002 12:16 am   

inserting a charater
 
how do I add a charater to a var? I need to add it from the right side.

I have a var with a value of "12345". This var is the result of some math triggers I run. "12345" is actually a number with two decimal points in it, and I want to put a decimal back in, to make the value "123.45" ...

the result of my math trigger will always have 2 decimal points, but may only be 4 charaters long (i.e. 1234 should still be 12.34)

Anyone know how to do this? thanks :)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 07, 2002 12:33 am   
 
x=%concat(%leftback(@x,2),".",%rightback(2))
or you could do
x=%trim(%format("&10.2f",@x))
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Apr 07, 2002 3:47 am   
 
Bear in mind that after you insert the . the variable will no longer be a number.

LightBulb
All scripts untested unless otherwise noted
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net