//字母个数?
function GetStrNum(str: string):integer;
var
i: integer;
begin
result := 0
for i := 1 to length(str) do
begin
if (str in ['a'..'z','A'..'Z']) then
begin
result := result + 1;
end
else
exit;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(inttostr(GetStrNum(edit1.Text)));
end;