用COPY(s,1,1)取出第一个字符,判断它是不是数字

解决方案 »

  1.   

        temp:string;
    begin
        temp:=copy(s,1,1);
        if temp in ['0'..'9'] then 
         result:=Ture
        else result:=False;
    end;
      

  2.   

    COPY(Str,1,1)~~拷贝第一个字符出来~~然后
    Typ
      StrTpInt(COPY(Str,1,1));
    except
      ShowMessage('不是数字!');
    end;
      

  3.   

    Function firstCharISNum(str:String):Boolean;
    var
       c:Char;
    const
       MIN_NUM_ASC=?   //0的Ascii序号
       MAX_NUM_ASC=?   //9的Ascii序号
    Begin
       c:=str[0];
       if (chr(c)>=MIN_NUM_ASC) And (chr(c)<=MAX_NUM_ASC) then Result:=True 
       else Result:=False;
    End;