-3

i'm trying to write a function that changes HTML-code to a new markup-languange. Where br and /br is replaced by *. Although, after the first * (br) no whitespace is allowed and before the second * (/br) no whitespace is allowed. An example is given bellow.

Strong emphasis

• The start and end of a section with strong emphasis is defined by '*'.

• The starting * must not be followed by Whitespace. The ending * must not be preceded by Whitespace. As an example, * fat cat*, *fat cat * and * fat cat * are not permitted

1 Answers1

0

Kinda vague on what you're using. If you're Using VB then this might help

Get the substring inside br by removing the br tag first then trim the trailing whitespaces on that substring using .Trim. Finally add the * on bothsides

Dim Oldstring As String = "br fat cat /br"
Dim Newstring As String = "*" + Oldstring.Substring(2, Oldstring.Length - 5).Trim + "*"