Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] Lazarus Pascal - Convert Text to HTML (strip HTML tags from text)
Delphi, Lazarus, Free Pascal
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2796
Topic starter
July 18, 2024 6:05 AM
After having written a function for this over again, I came to the conclusion that Lazarus Pascal comes with a function, called RenderHTML2Text, that already strips all HTML tags from text in the unit HTML2TextRender.
This function cleans up by removing all HTML tags.
I did find it best used one line at a time - I noticed it loosing line endings when throwing an entire file at it.
function RenderHTML2Text(const AHTML: String): String;