Possible Duplicate:
C# string formatting and padding
In my C# program, I have four variables:
string checkNo = "1234";
string checkAmount = "25.60";
string checkCashedDate = "120413";
string filler = " "; // three spaces
I'd like to build a string (26 positions long) that looks like this:
"00123400000002560120413 "
I can manually do, i.e. check each fields length (remove decimals), pad with the appropriate amount of zeros, append to final string. But, I was hoping that there was a quicker way. Like creating a string with a certain format (all zeros) and then "dropping in" the values. Is there anything like this available in C#? Thanks for any help and advice.