求助!请大家帮忙指点着一下这个isNumeric?

PYGJG 2004-04-12 02:32:39
本人在写程序时,遇有这个isNumeric,请大家帮忙指点一下!
本人不生感激!
...全文
70 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
bxh2dai 2004-04-12
  • 打赏
  • 举报
回复
呵呵,顶~!
jemmylau 2004-04-12
  • 打赏
  • 举报
回复
不好意思,忘记这是在delphi版了,这是java的,delphi没有正则表达式么?
jemmylau 2004-04-12
  • 打赏
  • 举报
回复
如果需要判断是否数字:
public static boolean isFloat(String s){
if((s != null) && !s.equals(""))
return s.matches("^[0-9]+[\\.]?[0-9]*$");
else
return false;
}
jemmylau 2004-04-12
  • 打赏
  • 举报
回复
//判断是否是整数
public static boolean isNumeric(String s)
{
if((s != null)&&(s!=""))
return s.matches("^[0-9]*$");
else
return false;
}
PYGJG 2004-04-12
  • 打赏
  • 举报
回复
在下十分感谢各位的帮忙!
zswangII 2004-04-12
  • 打赏
  • 举报
回复
var
I: Integer;
begin
if TryStrToInt('123', I) then
{ TODO }
end;
SunKinXing 2004-04-12
  • 打赏
  • 举报
回复
判断单个字符是否是数字型的字符

if IsNumeric('4') then
showmessage('Yes')
else
showmessage('No');
lzy6204 2004-04-12
  • 打赏
  • 举报
回复
DELPHI的帮助:
/*************
要USE IdGlobal 单元


Determines if a character is a numeric digit.


function IsNumeric(c: char): Boolean;

Parameters

c: char

Character to be examined.


Returns

Boolean - True if the character is a numeric digit.


Description

IsNumeric is a Boolean function that indicates if the character in c contains a numeric digit in the range '0'..'9'.
10975037 2004-04-12
  • 打赏
  • 举报
回复
有点晕.Delphi提供这个函数吗?

5,391

社区成员

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

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