begin TempStyle := RichEdit.Font.Style; StrLeft := StrToAdd; RichEdit.SelStart := Length(RichEdit.Text); while StrLeft <> '' do begin if (StrStartsWith(StrLeft, '', True, true)) then begin // Bold Style if StrStartsWith(StrLeft, '', True, True) then AddToStyle(TempStyle, fsBold); if StrStartsWith(StrLeft, '', True, True) then RemoveFromStyle(TempStyle, fsBold); // Italic Style if StrStartsWith(StrLeft, '', True, True) then AddToStyle(TempStyle, fsItalic); if StrStartsWith(StrLeft, '', True, True) then RemoveFromStyle(TempStyle, fsItalic); // Underline Style if StrStartsWith(StrLeft, '', True, True) then AddToStyle(TempStyle, fsUnderline); if StrStartsWith(StrLeft, '', True, True) then RemoveFromStyle(TempStyle, fsUnderline); // Color if StrStartsWith(StrLeft, '', True, True) then RichEdit.SelAttributes.Color := RichEdit.Font.Color; if StrStartsWith(StrLeft, '', False, True); try RichEdit.SelAttributes.Color := StringToColor(TempStr); except RichEdit.SelAttributes.Color := RichEdit.Font.Color; end; Delete(StrLeft, 1, 1); end; end else begin RichEdit.SelAttributes.Style := TempStyle; RichEdit.SelText := FromLeftUntilStr(StrLeft, '<', True, True); end; RichEdit.SelStart := Length(RichEdit.Text); end; RichEdit.SelText := #13#10; end;