Nick Kewney

Software Architect & Product Builder

Month: January 2011

OpenSRS Lookup Code

string Server = “https://rr-n1-tor.opensrs.net&#8221;;string Port = “55443”;string PostData = ” <?xml version=’1.0′ encoding=’UTF-8′ standalone=’no’ ?> ” + “<!DOCTYPE OPS_envelope SYSTEM ‘ops.dtd’> ” + ” <OPS_envelope> ” + ” <header>” + ” <version>0.9</version> ” + ” </header> ” + ” <body>” + ” <data_block>” + ” <dt_assoc> ” + ” <item key=”protocol”>XCP</item>” + ” <item key=”action”>LOOKUP</item>” …

OpenSRS Lookup Code Read More »

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 »