Posts

Showing posts with the label C Sharp

ASP Response.Write newline

Hi, all of you who have used ASP may have encountered situations where you require to write a text output to the screen. It can be easily done by using Response.Write("Hello world"); However, if you wish to append some more text to a newline, it would not work in the following ways. Response.Write("Hello world \n"); Response.Write("Good day."); The output of the above lines would be Hello world Good day. and NOT Hello world Good day. In order to overcome this, you can very simple place an html break tag inside the code. Response.Write("Hello world"); Response.Write("<br/>"); Response.Write("Good day."); The output would be the following. Hello world Good day. Cheers !!!

Dot NET Regular Expression

Hi, in this post, I will demonstrate how to use a Regular Expression using the Dot NET Framework. If you are new to Regular Expressions, this post would not be of much use. This is intended for an audience who knows regular expressions and need to implement a regular expression in their Dot NET code. There may be scenarios where you need to match a certain string with a Regular Expression. Using the Dot NET Framework, this becomes relatively easy. First, you need to import the namespace by defining using System.Text.RegularExpressions; Then, you can create a Regex object by calling its constructor. This is an overloaded constructor. I will show only one use of it. (You can explore the other!!!) Regex regularExpression = new Regex(" "); This would create a Regex object. Once created, you can call several methods to get the job done. I will show how the Replace method can be used to identify a character pattern and replace it with a character set of your own. (A good example i...