뉴스 기사를 표시하는 ASP.NET MVC 앱이 있고 기본 단락에 잘라내 기와 HTML 태그 스트리퍼가 있습니다. 예 :ASP.NET MVC SubString 도움말
public static string RemoveHTMLTags(this string text)
{
return Regex.Replace(text, @"<(.|\n)*?>", string.Empty);
}
public static string Truncate(this string text)
{
return text.Substring(0, 200) + "...";
}
을 나는 새 문서를 만들 때 그러나이 오류가 발생합니다 3-4 단어로 이야기를 말할 : Index and length must refer to a location within the string. Parameter name: length
두 기능 <p><%= item.story.RemoveHTMLTags().Truncate() %></p>
은 확장에서하고 있습니다
무엇이 문제입니까? 감사합니다
내가 가진 유일한 사람이 될 수없는 것 이 주제가 유용하다는 것을 알게되었습니다. – Myzifer