请问一个问题!!

DelphiBird 2002-05-13 05:00:35
如何判断一个字符串中是9个数字??
...全文
34 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
procedure007 2002-05-13
  • 打赏
  • 举报
回复
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;
DelphiBird 2002-05-13
  • 打赏
  • 举报
回复
写错了吧
taidy 2002-05-13
  • 打赏
  • 举报
回复
有些错误更正
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;
1nbud 2002-05-13
  • 打赏
  • 举报
回复
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;
taidy 2002-05-13
  • 打赏
  • 举报
回复
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;

5,928

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧