Created
June 27, 2016 12:17
-
-
Save sherpc/7552f6f6557cd1da0f81b9768a8e3875 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static string ContentToHtml(string content) | |
{ | |
var words = content | |
.Replace("\r\n", "<br/>") | |
.Replace("\n", "<br/>") | |
.Split(' ') | |
//.Select(ReplaceLinkWithAttribute) | |
.ToArray(); | |
return String.Join(" ", words); | |
} | |
private static string ReplaceLinkWithAttribute(string word) | |
{ | |
return word.StartsWith("http://") | |
? $"<a href=\"{word}\">{word}</a>" | |
: word; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment