var
  count,n:integer;
  str:string;
begin
  str:='3110566     12976    张三'
  count:=0;
  for i:=1 to length(str) do
    begin  
      if str[i]=' ' then
         inc(count);
     end;
end;

解决方案 »

  1.   

    先用LISTBOX将TXT文件打开
    在用过程
    procedure thg_zcgl.kg;
    var kg: array [0..38] of string;
    kzm,hc:string;
    i,NUM:integer;
    begin
      kg[0]:='';
      for i:=1 to 38  do
      begin
       if not(copy(LISTBOX.Text,i,1)=' ') then
             NUM=NUM+1
             dbedit1.text:=INTTOSTRING(‘NUM’);
    end;
      

  2.   

    memo.lines.loadfromfile
    s:=memo.lines[i]pos(' '.....
    delete .......
    inc(count)