Hi all,
Quick question, is there a way to pad int's or any other numeric datatype with leading zeros like this:
int a = 25;
int b = 003;
int c = a + b; // value of c is now 028
I'm not talking about printing with padded zeroes but actually doing computations with padded zeroes. I'm working on a part of a project that grabs files with the same name but with different id numbers:
textReport1.txt
textReport2.txt
textReport14.txt
textReport17.txt
But the problem is that the files are in file order rather than numeric order. When actually traversing the file list above the open file dialogue box wouldn't list them as such but as:
textReport1.txt
textReport14.txt
textReport17.txt
textReport2.txt
These files are created by another program that is out of my hands so I can't pad the id number with zeros when actually creating the file names.
So I would like to be able to grab the id numbers, pad them with zeros and make the necessary comparisions to find out which file should be opened next in numerical order.
Any help or insight will be greatly appreciated.
Thanks a million.
Quick question, is there a way to pad int's or any other numeric datatype with leading zeros like this:
int a = 25;
int b = 003;
int c = a + b; // value of c is now 028
I'm not talking about printing with padded zeroes but actually doing computations with padded zeroes. I'm working on a part of a project that grabs files with the same name but with different id numbers:
textReport1.txt
textReport2.txt
textReport14.txt
textReport17.txt
But the problem is that the files are in file order rather than numeric order. When actually traversing the file list above the open file dialogue box wouldn't list them as such but as:
textReport1.txt
textReport14.txt
textReport17.txt
textReport2.txt
These files are created by another program that is out of my hands so I can't pad the id number with zeros when actually creating the file names.
So I would like to be able to grab the id numbers, pad them with zeros and make the necessary comparisions to find out which file should be opened next in numerical order.
Any help or insight will be greatly appreciated.
Thanks a million.