Recent

Author Topic: Incompatible types: got "untyped" expected "ShortString"  (Read 12749 times)

j0x

  • Full Member
  • ***
  • Posts: 126
Incompatible types: got "untyped" expected "ShortString"
« on: August 13, 2010, 08:15:56 am »
i got this error
Code: [Select]
Error: Incompatible types: got "untyped" expected "ShortString"
here is the code im trying to run
Code: [Select]
procedure TfrmTags.btnUrlClick(Sender: TObject);
var
   i:integer;
   onPos:integer;
   a:string;
   b:string;
begin
  a := 'http://';
  for i := 0 to mmoNoUrl.Lines.Count - 1 do
  begin
      if AnsiContainsStr(mmoNoUrl.Lines.Strings[i],a) then
         onPos := AnsiPos(a,mmoNoUrl.Lines.Strings[i]);
         b := mmoNoUrl.Lines.Strings[i];
         mmoPutUrl.Lines.Add('[url]' + setlength(b,onPos-1) + '[/url]');
      //showmessage(mmoNoUrl.Lines.Strings[i]);
  end;
end;                                 

thanks in advance for any help

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Re: Incompatible types: got "untyped" expected "ShortString"
« Reply #1 on: August 13, 2010, 09:24:42 am »
check this operation
Code: [Select]
'[url]' + setlength(b,onPos-1) + '[/url]'SetLength does not return string.
« Last Edit: August 13, 2010, 09:29:04 am by irfanbagus »

j0x

  • Full Member
  • ***
  • Posts: 126
Re: Incompatible types: got "untyped" expected "ShortString"
« Reply #2 on: August 14, 2010, 08:33:43 am »
sorry for late reply but i just want you to know that iveseen your post already yesterday and i made a new code that now works here

Code: [Select]
procedure TfrmTags.btnUrlClick(Sender: TObject);
var
   i:integer;
   onPos:integer;
   a:string;
   b:string;
begin
  mmoPutUrl.Clear;
  a := 'http://';
  for i := 0 to mmoNoUrl.Lines.Count - 1 do
  begin
      b := AnsiLowerCase(mmoNoUrl.Lines.Strings[i]);
      if AnsiContainsStr(b,a) then
      begin
         onPos := AnsiPos(a,b);
         insert('[url]',b,onPos);
         mmoPutUrl.Lines.Add(b + '[/url]');
      end;
  end;
end;             

so thanks again

 

TinyPortal © 2005-2018