Utilisez des expressions régulières pour trouver des modèles de lien hypertexte. Ensuite, ré-enregistrez le contenu avec le html a tags.
EDIT: Voici un exemple pour vous aider à démarrer, cette tâche comme une application de la console pour voir ce qui se passe:
class Program
{
static void Main(string[] args)
{
string s = "http://www.google.com is the best site, followed then by http://www.yahoo.com";
string pattern = @"http(s)?://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern);
System.Text.RegularExpressions.MatchCollection matches = regex.Matches(s);
for (int i = 0; i < matches.Count; i++)
{
Console.WriteLine(string.Format("<a href=\"{0}\">{1}</a>", matches[i].Value, matches[i].Value)); }
}
}
Le modèle d'expression régulière a été prise à partir de: http://weblogs.asp.net/farazshahkhan/archive/2008/08/09/regex-to-find-url-within-text-and-make-them-as-link.aspx
Pouvez-vous s'il vous plaît donner le code pour la référence –