每一个函数定义的前面都要加Tform1
Function Tfrom1.GetSubStrNum(aString:String;SepChar:String):integer;//函数1

解决方案 »

  1.   

    错误信息是:value assingned to 'strlen'never used
      

  2.   

    to fyje(冬原)大哥:
    我照你的方法去做,果然行,你真棒,谢谢你帮助小妹了。
    怎么才能给分你呀,我不知道怎么操作?
      

  3.   

    当然会出错啦!
    for j:=1 to num do
        item[j]:=getsubstr(myline,sepchar);
        table1.Open;
    你在执行这段程序时,当j=1执行完后,会得到Temp[1]中确实有姓名,虽然你在Function GetSubStr(var aString:String;SepChar:String):String;//函数2中也用了Delete(aString,1,SepCharPos); //除去分割符和分割符前的子串
    来删除掉已经得到的姓名,但并没有返回,所以当第二次扫行时,myline依然是原来的myline,没有删除掉姓名,所以你每次得到的都是姓名,不信你可设断点单步执行看看
      

  4.   

    var
    myline,myline1:string;
    j:integer;
    f1,f2,f3:string;
    for i:=0 to memo1.lines.count-1 do
    begin
    myline:=memo1.Lines[i];for i:=1 to length(myline) do
    begin
    if myline[i]<>',' then
       begin
        
        myline1:=myline1+myline[i];
       end
    else
    begin
    j:=j+1;
    myline1:='';
    case i of
     1:f1:=myline1;
     2:f2:=myline1;
     3:f3:=myline1;
    end;
    if j=3 then //当为结束字段的时候
     with table1 do
         begin
          table1.Insert;
          table1.FieldByName('name').asstring:=item[1];
          table1.FieldByName('age').asstring:=item[2];
          table1.FieldByName('title').asstring:=item[3];
          table1.Post;
         end;end;
    end;
      

  5.   

    你应该把下面两个函数的声明写在 private 部分:
    Function GetSubStrNum(aString,SepChar:String):Integer;
    Function GetSubStr(var aString:string; SepChar:String):String;并且在implementation部分
    Function TForm1.GetSubStrNum(aString,SepChar:String):Integer;
    Function TForm1.GetSubStr(var aString:string; SepChar:String):String;