快被它郁闷死了。

今天第一次写Delphi代码,老是提示“Constant expression expected”。折腾了2个来小时,才解决这个问题,原来就少了一个begin...end;
太恶心了,错误提示和真正的原因一点都不着边,欲哭无泪啊。

出错代码:
  case param[1][1] of
    'd':
      parts[i] := DateToStr(Date);
    'i':
        parts[i] := '';
        iIndexStart := StrToInt(param[2]); //老提示这里出错
        iIndexPosition := i;
        iIndexLength := StrToInt(param[3]);
    'r':
        parts[i] := '';
        iRndPosition := i;
        iRndLength := StrToInt(param[2]);
    end;

改下后代码:
  case param[1][1] of
    'd':
      parts[i] := DateToStr(Date);
    'i':
      begin
        parts[i] := '';
        iIndexStart := StrToInt(param[2]);
        iIndexPosition := i;
        iIndexLength := StrToInt(param[3]);
      end;
    'r':
      begin
        parts[i] := '';
        iRndPosition := i;
        iRndLength := StrToInt(param[2]);
      end;
    end;

posted @ 2006-05-03 00:48  伊飏  阅读(512)  评论(2)    收藏  举报