Geeks With Blogs


Add to Google

Tim Hibbard CEO for EnGraph software January 2008 Entries
Extension Method - String.ToFixedLength
This very simple extension method makes a string a fixed length. It appends whitespace to a string that is shorter than required or strips characters to a string to is longer than requested. See ScottGu blog post for a brush up (or intro) on extension methods. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ParaPlan.Extensions { public static class StringHelper { public static string ToFixedLength(this string s, int width) { string rv = s; if (s.Length ......

Posted On Tuesday, January 29, 2008 11:09 AM

Copyright © Tim Hibbard | Powered by: