ICT
the blog for ICT
ken013194
暱稱: ホロ
性別: 男
國家: 香港
地區: 葵青區
« July 2026 »
SMTWTFS
1234
567891011
12131415161718
19202122232425
262728293031
最新文章
Text File
Arrays
String Procedures
String Functions
String Operation
文章分類
全部 (23)
Programming Language (23)
訪客留言
最近三個月尚無任何留言
每月文章
日誌訂閱
尚未訂閱任何日誌
好友名單
尚無任何好友
網站連結
尚無任何連結
最近訪客
最近沒有訪客
日誌統計
文章總數: 23
留言總數: 0
今日人氣: 2
累積人氣: 85
站內搜尋
RSS 訂閱
RSS Feed
2009 年 9 月 11 日  星期五   晴天


String Procedures 分類: Programming Language

High-level Programming Language (Pascal)

String Procedures

  • val (<InStr>, <Num>, <ErrorCode>)
    • converts a <InStr> to its numeric equivalent
    • if the conversion is successful, <Num> is assigned this numeric value and the <ErrorCode>, is assigned the value 0
    • if the conversion is unsuccessful, <ErrorCode> is assigned the position of the first invalid character in the <InStr> and <Num> is set to 0
    • if <Num> is declared as an integer, the <InStr> will be converted into an integer
    • if <Num> is declared real, the <InStr> will be converted into real
    • <ErrorCode> must be declared as an integer
    • for example,

       
    InStr
    Data type of Num
    Num
    ErrorCode
    Remarks
    '153'
    integer
    153
    0
    Valid conversion
    '153'
    real
    1.5300000000E+02
    0
    Valid conversion
    '52.68'
    real
    5.2680000000E+01
    0
    Valid conversion
    '52.68'
    integer
    0
    3
    Decimal point is invalid for Num being an integer
    '7A12'
    integer
    0
    2
    First invalid character is A
  • str (<Num>, <OutStr>)
    • converts a numeric value, <Num>, to its string representation and assigns this string value to <OutStr>
    • <OutStr> must be string data type
    • field descriptors can be included in the str procedure to specify the string format
    • str (<Num>:<w>:<d>, <OutStr>)
    • for example,
    Num
    Data type of Num
    Procedure call
    OutStr
    135
    integer
    str (Num, OutString) 135
    135.0
    real
    str (Num, OutString)  1.3500000000E+02
    135.79
    real
    str (Num:8:3, OutString)  135.790
    24.3432
    real
    str (Num:2:0, OutString) 24

 






訪客留言 (返回 ken013194 的日誌)

訪客名稱:
電郵地址: (不會公開)
驗證碼:  按此更新驗證碼 (如看不清楚驗證碼請點擊圖片刷新)
俏俏話: (必需 登入 後才能使用此功能)
[ 開啟多功能編輯器 ]