• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

Code Assistance Needed Not working)

Hi all,

I've put together this procedure that is mean't to change all html Tags in a TSynMemo component ...called Memo1 to lowercase.

For some reason it's not downing anything ...could someone help please?

thx

st3vo
0
ST3VO
Asked:
ST3VO
  • 3
  • 2
1 Solution
 
ST3VOAuthor Commented:
downing  := doing ... exuse my spelling :o)
0
 
HypoCommented:
You have to attach the procedure so that we have something to have a look at... :)
0
 
ST3VOAuthor Commented:
oopsss sorry :o)  

Here is it:
////////////////////////////////////////
//  CONVERT ALL TAGS TO LOWER CASE
///////////////////////////////////////
Procedure TForm1.LowercaseHtmlTags;
var
  taglist : TStringList;
  i       : Integer;
begin
  taglist.Add('DIV');
  taglist.Add('HEAD');
  taglist.Add('TITLE');

  for i := 0 to taglist.Count-1 do
  memo1.text := stringreplace(memo1.Text, '<' + taglist[i], '<' + lowercase(taglist[i]), [rfReplaceAll, rfIgnoreCase]);
end;

Open in new window

0
 
HypoCommented:
You have to create the TStringList object, or else you will add the tags to an invalid TStringsList, and since it is invalid, the count property will probably not be correct either...

try this function instead

/Hypo
Procedure TForm1.LowercaseHtmlTags;
var
  taglist : TStringList;
  i       : Integer;
begin
  taglist := TStringList.Create;
  try
    taglist.Add('DIV');
    taglist.Add('HEAD');
    taglist.Add('TITLE');

    for i := 0 to taglist.Count-1 do
      memo1.text := stringreplace(memo1.Text, '<' + taglist[i], '<' + lowercase(taglist[i]), [rfReplaceAll, rfIgnoreCase]);
  finally
    taglist.free;
  end;
end;

Open in new window

0
 
ST3VOAuthor Commented:
Perfect Thanks!!! :o)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now