function StrHikaku(a,b:string):boolean;
  var
    idxA,idxB:Integer;
    wLenA,wLenB:integer;
    wUMC,wWC1,wWC2:Boolean;
  begin
    wLenA:=Length(a);
    wLenB:=Length(b);

    wUMC:=False;
    wWC1:=False;
    wWC2:=False;
    idxA:=0;
    for idxB:=1 to wLenB do
    begin

      if (wWC1=False) then
      begin
        inc(idxA);
        if (idxA>wLenA) then wUMC:=True;
      end;

      if (a[idxA]='*') then
      begin
        inc(idxA);
        if (idxA>wLenA) then wWC2:=True;
        wWC1:=True;
      end;
      if (a[idxB]='?') then wWC2:=True;

      if (wWC2=False) then
      begin
        if (a[idxA]=b[idxB]) then
        begin
          if (wWC1=True) then wWC1:=False;
        end else begin
          if (wWC1=False) then wUMC:=True;
        end;
      end;
      wWC2:=False;

      if (wUMC=True) then Break;

    end;

    if (wUMC=True) then
      result := false
    else
      result := true;

  end;