Remove White Space with Regex

Here is a very handy extension method to remove white spaces from strings.     1 public static string RemoveWhiteSpace(this string TextToRemoveWhiteSpaces)     2 {     3     string pattern = "\\s+";     4     string replacement = " ";     5     string result = Regex.Replace(TextToRemoveWhiteSpaces, pattern, replacement);     6     return result;     7 } Adapted from http://msdn.microsoft.com/en-us/library/xwewhkd1.aspx Happy […]

Think

When we are coding we never forget to use our brain. Always ask ourselves. “Is there another way to do this?”, “What am I doing here?”. If we are copying someone else’s code. We need to understand purpose of the code well. Look at the sample I choose for you and you will understand why […]

Split Function

All of the web applications that i am responsible to maintain have lots of stored procedures. And to many of them builds a SQL string and executes at the end of the procedure. Previous programmers wrote these SPs in that way because they don’t know how to handle comma separated ID values. For these cases […]

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top