Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / DBP - Forcing digits

Author
Message
Captain GerBear
18
Years of Service
User Offline
Joined: 9th Jul 2006
Location:
Posted: 3rd Aug 2006 03:20
Hey guys, sorry if this is a dumb question, but can I force a variable to maintain a certain number of digits? For instance, can I force 12 to become 0012?
D Ogre
20
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 3rd Aug 2006 05:59
Like this?

Captain GerBear
18
Years of Service
User Offline
Joined: 9th Jul 2006
Location:
Posted: 3rd Aug 2006 06:53
I don't understand at all what that means, but yes, that works perfectly, thank you.
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 3rd Aug 2006 09:47
What that does is turn the number into a string, and puts two zeroes in front of it. Or it would take a three digit number and put one zero in front of it. You can't do math on a String unless you get the value of it.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Aug 2006 11:43
Here's a handy reusable function.



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike

Login to post a reply

Server time is: 2024-09-25 05:28:47
Your offset time is: 2024-09-25 05:28:47