我现在想
case strtoint(s1) of
211: showmessage('heelo');
220: showmessage('what');
end;
但s1有可能是字母而不是数字, 所以在转的时候会出错, 如何实现是字母的就不管它转下一个? 也就是说try .. except语法如何写?
case strtoint(s1) of
211: showmessage('heelo');
220: showmessage('what');
end;
但s1有可能是字母而不是数字, 所以在转的时候会出错, 如何实现是字母的就不管它转下一个? 也就是说try .. except语法如何写?
case strtoint(s1) of
211: showmessage('heelo');
220: showmessage('what');
end;
except
showmessage(程序出错)
end;
211: showmessage('heelo');
220: showmessage('what');
0: ShowMessage('輸入非數字串');
end;
showmessage(程序出错) //这里写什么让程序不管它继续循环???
end;
211: showmessage('heelo');
220: showmessage('what');
-1:showmessage('number please!'); end;
case strtointdef(s1, 0) of
211: showmessage('heelo');
220: showmessage('what');
0: ShowMessage('輸入非數字串');
end;
except
showmessage(程序出错)
end;
case strtoint(s1) of
211: showmessage('heelo');
220: showmessage('what');
end;
except
end;