namespace RMuseum.Utils { /// /// divan poem tools /// public static class DivanPoemTools { /// /// get an excerpt for the poem /// /// /// public static string GetPoemHtmlExcerpt(string poemHtml) { while (poemHtml.IndexOf("id=\"bn") != -1) { int idxbn1 = poemHtml.IndexOf(" id=\"bn"); int idxbn2 = poemHtml.IndexOf("\"", idxbn1 + " id=\"bn".Length); poemHtml = poemHtml.Substring(0, idxbn1) + poemHtml.Substring(idxbn2 + 1); } poemHtml = poemHtml.Replace("
"); int count = 0; while (index != -1 && count < 5) { index = poemHtml.IndexOf("
", index + 1); count++; } if (index != -1) { poemHtml = poemHtml.Substring(0, index); poemHtml += "
[...]