9个数字var t: char;if  length(astring) = 9  
begin   
  for i:= 1 to  length(astring) 
  t:= pos(astring,i,1)    
  if not isnumberic(t) then
  begin  
    showmessage('Error')
    break;
  end
  
end;

解决方案 »

  1.   

    function IsNumber9(s:string);
    begin
      Result:=Length(s)=9;
      if Result then
        for i:=1 to 9 do
          if not(s[i] in ['0'..'9']) then Result:=false;
    end;
      

  2.   

    有些错误更正
    var
       i:integer;
       t,astring :  string;// to be test;
    begin
      if  length(astring) = 9 then
      begin
        for i:= 1 to  length(astring) do
        begin
          t:= copy(astring,i,1);
          if pos(t,'0123456789')=0 then
          begin
            showmessage('Error');
            break;
          end;
        end;
      end;
    end;
      

  3.   

    function IsNumber(s:string);Boolean;
    begin
      Result:=Length(s)=9;
      if Result then
        for i:=low(S) to hi(s) do
          if not(s[i] in ['0'..'9']) then Result:=false;
    end;