FormatFloat 格式化浮點數


#和0的區別:

   #是對應位有值顯示,無值不顯示

   0是對應位有值顯示,無值顯示0

 

分號后的字符串是對負值的格式化特殊定義:

 s := FormatFloat( '00.0;(0.00)', 1.123 ); 
  //返回: 01.1

 

s := FormatFloat( '00.0;(0.00)', -1.123); 
  //返回: (1.12)

 

 

 其他格式化:

 s := FormatFloat('###.###',12.3456); 
  //返回: 12.346 
  s := FormatFloat('000.000',12.3456); 
  //返回: 012.346 
 
  s := FormatFloat('#.###',12.3); 
  //返回: 12.3 
  s := FormatFloat('0.000',12.3); 
  //返回: 12.300 
 
  s := FormatFloat('#,#.#',1234567); 
  //返回: 1,234,567 
  s := FormatFloat('0,0.0',1234567); 
  //返回: 1,234,567.0 
 
  s := FormatFloat('0.00E+0',1234567); 
  //返回: 1.23E+6 
  s := FormatFloat('0.00E+00',1234567); 
  //返回: 1.23E+06


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM