Nick Kewney

Software Architect & Product Builder

Day: January 11, 2011

String Extension Collection for C#

This article brings a small collection of my more commonly used string extensions. For those who don’t know about extension methods, I suggest reading this short article. Get the initials from a string public static string ToInitials(this string str) { return Regex.Replace(str, @”^(?’b’w)w*,s*(?’a’w)w*$|^(?’a’w)w*s*(?’b’w)w*$”, “${a}${b}”, RegexOptions.Singleline) } Remove line breaks from string public static string RemoveLineBreaks(this …

String Extension Collection for C# Read More »