Reputation: 51
I have Inbox tab in my project there i want to show only 40 chararacters of body instead of all body.Problem is that if there is img tag exsist in body when i got 40 characters of body using substring sometimes this img tag comes with all attributes means full src but sometime it doesnot come means src can be cut.so how to remove this img tag from body and get only simple text.
Upvotes: 1
Views: 2119
Reputation: 179452
For a quick hack, you can use a regular expression like the following:
Dim input As String = "test<img>" ' your data here
Dim imgRegex As New Regex("<img[^>]*>", RegexOptions.IgnoreCase)
Dim output As String = imgRegex.Replace(input, "")
For more general HTML parsing, you should use the HTML Agility Pack.
Upvotes: 1