Thursday, January 27, 2011

.net Formatting Strings - Fixed Width

I always forget the specific syntax for formatting strings into a specified width. When I google, I always get number and date formatting, but have to really look for the STRING format.

So here it is for my easy reference:)

String.Format("{0,20}", "String goes here");
String.Format("{0,-20}", "String goes here");

No comments:

Post a Comment