-1

I have a datagrid with ButtonColumn with text. Now, I need to exclude specific text of that ButtonColumn.

Dim lnkButton As LinkButton = CType(grdTicket.SelectedItem.Cells(5).Controls(0), LinkButton)
Dim myString as String = ""

example text of lnkButton = 
"1 UNIT COMPUTER SET # 8082 <br /><span> - text "Sample Text".</span>

Now, how can I remove the texts starting from the word <br /> up to </span>?

So that the value of myString will only become 1 UNIT COMPUTER SET # 8082

I already tried using Replace function, but what I need to do is not only remove br and span, but also remove the texts between those 2 text

Dale
  • 159
  • 4
  • 20
  • http://stackoverflow.com/questions/17252615/get-string-between-two-strings-in-a-string, http://stackoverflow.com/questions/1359412/remove-text-in-between-delimiters-in-a-string-using-a-regex – CodeCaster May 05 '17 at 07:44

1 Answers1

1

Should be fairly simple.

Dim lnkButton as String = "1 UNIT COMPUTER SET # 8082 <br /><span> - text"
lnkButton.Substring(0, lnkButton.IndexOf("<br />"))
Orel Eraki
  • 11,940
  • 3
  • 28
  • 36