Hey guys,
So I've got a fun problem for you all. @Carnage, I know you're good with C#, but are you good with C?
So there's the code, and here's what it currently spits out.
http://imgur.com/a/cTSkd
Circled is the problem. The massive amount of space between the $ signs, and the actual values. My research has concluded that I could probably do some wacky space insertion into the string using an extension method, but I'm not entirely sure how to go about this.
The reason why I need the spaces inserted is to keep the | characters aligned with eachother, but I still want the variables to line up nicely too Right now, the %24 is keeping the pipe characters aligned, but at the sacrifice of variable alignment.
Any ideas people?
Cheers,
Luke
So I've got a fun problem for you all. @Carnage, I know you're good with C#, but are you good with C?
Code:
printf("| Bakov Invoice (keep for internal billing) |\n");
printf("|---------------------------------------------|\n");
// %-26s adds 26 spaces to trail the variable.
printf("| Company ID : %26s|\n", companyIdLookup);
printf("| Company Name : %26s|\n", companyNameLookup);
printf("| Product ID : %26s|\n", productCodeLookup);
printf("| Product Name : %26s|\n", productDescriptionLookup);
printf("| Products Ordered: %26d|\n", numberOrdered);
printf("| Tax : $ %24.2f|\n", taxPaid);
printf("| Invoice Amount : $ %24.2f|\n", totalCost);
printf("|---------------------------------------------|");
So there's the code, and here's what it currently spits out.
http://imgur.com/a/cTSkd
Circled is the problem. The massive amount of space between the $ signs, and the actual values. My research has concluded that I could probably do some wacky space insertion into the string using an extension method, but I'm not entirely sure how to go about this.
The reason why I need the spaces inserted is to keep the | characters aligned with eachother, but I still want the variables to line up nicely too Right now, the %24 is keeping the pipe characters aligned, but at the sacrifice of variable alignment.
Any ideas people?
Cheers,
Luke
Last edited: