Thursday, March 1, 2012

Replace string using regex in C#

I use regular expression extensively. So this is my favorite function for replacing a string. Basically code will remove all digits from the given string.

x = Regex.Replace(x, @"\d+", "");

Or everything after starting the digit.
x = Regex.Replace(x, @"\d.*$", "");

No comments:

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...