Tim Hibbard

CEO for EnGraph software
posts - 628 , comments - 1631 , trackbacks - 459

My Links

News



Add to Google

Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

EnGraph Blogs

Links

Other

Roll

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 | Comments (3) | Filed Under [ .NET ]

Powered by: