Programmer 的進程 - 由 VB6 開始

Xojo / RealBasic 相關文件及程式庫 => Xojo / RealBasic 範例及函式庫 => Topic started by: admin on August 23, 2011, 07:35:05 PM

Title: Round 函數強化版
Post by: admin on August 23, 2011, 07:35:05 PM
Code: [Select]
Function czRound(tmpValue as double,optional tmpDigit as integer=0) As double
  dim tmpResult as double=0
  dim tmpFormat as string="#"
  dim intX as integer
  if tmpdigit >0 then
    tmpformat="#."
    for intx=1 to tmpDigit
      tmpFormat=tmpFormat +"#"
    next
  end if
 
  tmpResult=cdbl(format(tmpvalue,tmpFormat))
 
  return tmpResult
 
 
End Function