Forum > LCL

Basic HTML Generation...

<< < (4/4)

commodianus:
Thanks again everyone. All accomplished.

commodianus:
eny, would modifying your last bit of code to do <i>" and "</i> be very complicated? I didn't notice that at first, but I don't want to overstay my welcome either. :P

commodianus:
This does the trick. Thanks all, really done this time.


--- Code: ---procedure TForm1.Quote;
const C_BOOL2HTML_ITALIC: array[boolean] of string = ('<i>', '</i>');
var i      : integer;
    s      : string;
    InQuote: boolean;
    before, after : string;
begin
  Memo2.Lines.Clear;
  for i := 0 to Memo1.Lines.Count-1 do
  begin
    s := Memo1.Lines[i];
    InQuote := false;
   while pos('"',s) > 0 do
    begin
      s := StringReplace(s, '"', C_BOOL2HTML_ITALIC[InQuote], []);
      InQuote := not InQuote;
    end;
    if InQuote then
      s := s + C_BOOL2HTML_ITALIC[InQuote];
    Memo2.Append(s);
  end;
  Memo1.Text := Memo2.Text;

  Application.ProcessMessages;

  Memo1.Text := StringReplace(Memo1.Text, '<i>', '<i>"',
                          [rfReplaceAll, rfIgnoreCase]);

  Memo1.Text := StringReplace(Memo1.Text, '</i>', '"</i>',
                          [rfReplaceAll, rfIgnoreCase]);

end;
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version