|
-
Mar 31st, 2005, 10:10 AM
#1
Thread Starter
Fanatic Member
Fixed Number of digits
How would I output a fixed number of digits. I DO NOT mean a fixed number of digits after the decimal point. I mean a fixed number of digits ALWAYS no matter what my number turns out to be.
How can this be done in C# and in C if anyone knows.
Thanks!
-
Mar 31st, 2005, 10:25 AM
#2
Re: Fixed Number of digits
4 digits regardless of the number?
int n = 34;
Console.WriteLine(n.ToString("0000");
This works if the number is less than 4 digits, now is the number is greater than 4 digits which ones are you going to get rid of?
you can always create a custom format here's and example:
http://authors.aspalliance.com/aspxt...atstrings.aspx
Last edited by DeadEyes; Mar 31st, 2005 at 10:56 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|