专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Delphi

delphi7 怎么判断输入的字符串是一个实数(包括指数和小数),请求高手帮忙

发布时间:2011-06-24 19:38:13 文章来源:www.iduyao.cn 采编人员:星星草
delphi7 如何判断输入的字符串是一个实数(包括指数和小数),请求高手帮忙
内容如题...
------最佳解决方案--------------------
可以利用类型转换函数,-1代表一个不可能出现的值
Result := StrToFloatDef(XXX, -1) <> -1;
------其他解决方案--------------------
function   StrToFloat(const   S:   string):   Extended;   
    
Description:     
  Use   StrToFloat   to   convert   astring,   S,   to   a   floating-point   value.   S   must   consist   of   an   optional   sign   (+   or   -),   a   string   of   digits   with   an   optional   decimal   point,   and   an   optional   mantissa.   The   mantissa   consists   of   'E'   or   'e'   followed   by   an   optional   sign   (+   or   -)   and   a   whole   number.   Leading   and   trailing   blanks   are   ignored.      
  The   DecimalSeparator   global   variable   defines   the   character   that   must   be   used   as   a   decimal   point.   Thousand   separators   and   currency   symbols   are   not   allowed   in   the   string.   If   S   doesn't   contain   a   valid   value,   StrToFloat   raises   an   EConvertError   exception.
//if there is a exception, the string isn't a float or double
------其他解决方案--------------------
typeof()
------其他解决方案--------------------
顶下,不懂,呵呵!
------其他解决方案--------------------
引用:
function StrToFloat(const S: string): Extended;  
   
Description:  
  Use StrToFloat to convert astring, S, to a floating-point value. S must consist of an optional sign (+ or -), a string of digi……


麻烦写个实际代码??
------其他解决方案--------------------
使用正则表达式!可以帮你解决这个问题

------其他解决方案--------------------
不明白。。
------其他解决方案--------------------
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: