Tuesday, December 13, 2011

string manipulation cheatsheat

http://idunno.org/archive/2004/07/14/122.aspx seems like a cool cheatsheet on string formatting! I like:

String.Format("--{0,10}--", "test");

 
 

Which spits out:

--      test--

 
 

I made an order number at least six digits like so:

string foo = String.Format("{0,10}", row["OrderNumber"].ToString()).Replace(" ","0");

 
 

As we are discussing string manipulations, please see:

No comments:

Post a Comment