Currently I'm working on a project to strip all unnecessary HTML. I've got it al working but I'm using the following code to replace double spaces:
Private Function stripDubbleSpace(ByVal fileContent As String) As String
While fileContent.IndexOf(" ") <> -1
fileContent = fileContent.Replace(" ", " ")
End While
Return fileContent.Replace(" ", " ")
End Function
The code above works, but within a HREF or and SRC the url will go to a 404 when you replace a double space by 1 space. Don't ask by why there are spaces in my URL, I'm aware that's not the best way.
Example:
/images/my img.jpg
(2 spaces) would be replaced by /images/my img.jpg
(1 space), which should not be replaced.
How can I only replace the double spaces when it's not within a HREF or SRC?