All pastes #32542 Raw Edit

Mine

public text v1 · immutable
#32542 ·published 2005-12-05 17:44 UTC
rendered paste body
using System;
using System.Text.RegularExpressions;
namespace HowTo
{
	public class dataHandler
	{
		public dataHandler()
		{
		}
		public static string csharpConvertString(string strConvert)
		{
			string strConvertedString = strConvert;

			string[] regExpPattern = new string[2];
			regExpPattern[0] = @"(.*?)\[csharp\](.*?)(using)(.*?)\[/csharp\](.*?)";			
			regExpPattern[1] = @"(.*?)\[csharp\](.*?)(string)(.*?)\[/csharp\](.*?)";
			
			
			string[] regExpReplace = new string[2];
			regExpReplace[0] = @"$1$2<font color=blue>$3</font>$4$5";			
			regExpReplace[1] = @"$1$2<font color=blue>$3</font>$4$5";
			

			/*
				[c-sharp]
				using System;
				string strTest = new string;
				[/c-sharp]
			
			 */

			for ( int i = 0 ; i < regExpPattern.Length; i ++)
			{
				strConvertedString = Regex.Replace(strConvertedString, regExpPattern[i], regExpReplace[i]);
			}

			return strConvertedString;
		}
	}
}