Jump to content

how to copy text from UniDBHtmlMemo without Html tag


uniguibbs

Recommended Posts

Hi uniguibbs.

 

 

Try this function:
 

function StripHtmlMarkup (const source: string): string;
var i, count: Integer;
    InTag: Boolean;
    P: PChar;
begin
  SetLength (Result, Length (source));
  P := PChar (Result);
  InTag := False;
  count := 0;
  for i := 1 to Length (source) do
    if InTag then
      begin
        if source [i] = '>' then InTag := False;
      end
    else
      if source [i] = '<' then InTag := True
      else
        begin
          P [count] := source [i];
          Inc (count);
        end;
  SetLength (Result, count);
end;

for example:
 

UniMemo1.Text := StripHtmlMarkup (UniHTMLMemo1.Text);

Source: http://stackoverflow.com/questions/5717405/how-to-extract-text-from-such-type-of-html-source

 

 

...or you can look in the direction of regular expressions...

 


Sincerely.

  • Upvote 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...