rendered paste bodyusing System;
using System.Text.RegularExpressions;
namespace HowTo
{
public class dataHandler
{
public dataHandler()
{
}
/// <summary>
/// csharpConvertString is used for converting my c# syntax inside my code
/// </summary>
/// <param name="strConvert">This is the input string that we want to conver</param>
/// <returns>returns a fixed string with replaced highlighting</returns>
public static string csharpConvertString(string strConvert)
{
/************* Input exampel***************/
// [c-sharp]
// using System;
// string strTest = new string;
// [/c-sharp]
//
/******************************************/
string strConvertedString = strConvert;
string[] regExpPattern = new string[2];
regExpPattern[0] = @"(\[csharp\])(.*)(using)(.*)(\[\/csharp\])";
regExpPattern[1] = @"(\[csharp\])(.*)(string)(.*)(\[\/csharp\])";
regExpPattern[1] = @"(\[csharp\])(.*?)(\r\n)(.*?)(\[\/csharp\])";
string[] regExpReplace = new string[2];
regExpReplace[0] = @"$1font color=blue>$3</font>$4";
regExpReplace[1] = @"$1<font color=blue>$3</font>$4";
regExpReplace[1] = @"$2<br />$3";
/*
*/
for ( int i = 0 ; i < regExpPattern.Length; i ++)
{
strConvertedString = Regex.Replace(strConvertedString, regExpPattern[i], regExpReplace[i]);
}
return strConvertedString;
}
}
}