• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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