دوست عزیز شما باید از تابع substring استفاده کنی
ولی اولش باید متن رو تبدیل به متن سالم بکنید
من تو دات نت از کد زیر استفاده میکنم
public string GetTextonly(string editorcontent)
{
string strtext = "";
strtext = Regex.Replace(editorcontent, @"<(.|\n)*?>", string.Empty);
return strtext;
}