zoukankan      html  css  js  c++  java
  • IsNumeric 判断字符串是否为数字(使用Val函数实现),这个函数相当于Java的IsNaN函数

    IsNumeric 判断字符串是否为数字,如果是数字返回true,如果包含有汉字或字符的话返回false. 由于Delphi本身没有IsNumeric这个函数,不像其它语言,这个函数相当于Java的IsNaN函数。

    delphi代码
    function IsNumeric(AStr: string): Boolean; 
    var 
    Value: Double; 
    Code: Integer; 
    begin 
    Val(AStr, Value, Code); 
    result := Code = 0; 
    end;
    ____________________________________________________________________________________________
    方法二:
    function StrCheck(RemitStr: string): string;
    var
    VV:string;
    begin
    if StrToFloatDef(RemitStr,0)<>0 then
    Result:=''
    else
    begin
    VV:= RemitStr;
    VV:=StringReplace(VV, '0', '', [rfReplaceAll, rfIgnoreCase]);
    VV:=StringReplace(VV, '.', '', [rfReplaceAll, rfIgnoreCase]);
    if Length(trim(VV))>0 then
    Result:=RemitStr;
    end;
    end; 
    ---------------------
    作者:清风古韵
    来源:CSDN
    原文:https://blog.csdn.net/ttpage/article/details/9161719
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    次小生成树(SST)
    传纸条(scrip)
    动态规划练习5
    动态规划练习4
    整数的lqp拆分
    [HNOI2002]跳蚤
    BZOJ1803: Spoj1487 Query on a tree III
    51nod-1526: 分配笔名
    51nod-1615: 跳跃的杰克
    BZOJ2588: Spoj 10628. Count on a tree
  • 原文地址:https://www.cnblogs.com/findumars/p/10152723.html
Copyright © 2011-2022 走看看