Geeks With Blogs

Neat Stuff Read all my hurricane entries While you are here, visit the Geeks With Blogs main feed
Links Status of the Navy
Channel 9

.NET Hobbyist Programmer Staying Confused in a Busy World August 2010 Entries
After my previous post on truncating a .NET String at the end of a word, I thought that the simpler problem of just truncating a string to a specific length, while retaining all the rest of the code’s features, would have been obvious, but I got a couple of email requests. So here it is. /// <summary> /// Truncate a string to the specified length. /// </summary> /// <param name="value">The input string.</param> /// <param name="length">The maximum length of the returned ......

Posted On Saturday, August 28, 2010 10:32 PM

I recently worked with a friend on a small C# teaching project. We started with the premise of writing a String Truncate function for .NET 3.5 SP 1. At its simplest, this is trivial to create. public String Truncate(String input, int length) { return input.Substring(0, length); } After a review of the weaknesses of this implementation, we went in search of a more meaningful challenge. We expanded on this first effort with a few additional requirements: Input validation Do not truncate in the middle ......

Posted On Monday, August 23, 2010 7:15 PM

Copyright © Mark Treadwell | Powered by: | Join free