function Format(const Format: string; const Args: array of const): string; $[SysUtils.pas
功能 返回按指定方式格式化一個數組常量的字符形式
說明 這個函數是我在Delphi中用得最多的函數,現在就列舉幾個例子給你個直觀的理解
"%" [索引 ":"] ["-"] [寬度] ["." 摘要] 類型
Format('x=%d', [12]); //'x=12' //最普通
Format('x=%3d', [12]); //'x= 12' //指定寬度
Format('x=%f', [12.0]); //'x=12.00' //浮點數
Format('x=%.3f', [12.0]); //'x=12.000' //指定小數
Format('x=%8.2f'[12.0]) // 'x= 12.00' ;
Format('x=%.*f', [5, 12.0]); //'x=12.00000' //動態配置
Format('x=%.5d', [12]); //'x=00012' //前面補充0
Format('x=%.5x', [12]); //'x=0000C' //十六進制
Format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引
Format('x=%p', [nil]); //'x=00000000' //指針
Format('x=%1.1e', [12.0]); //'x=1.2E+001' //科學記數法
Format('x=%%', []); //'x=%' //得到"%"
S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //連接字符串
format函數的使用
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
python matplotlib繪圖時圖例顯示問題
hfut_jf
2020-07-04 03:02:00
CSS常見問題歸納與整理(收集了30多個)
Conso1e
2020-07-03 17:09:28
Foxmail 添加QQ郵箱失敗 提示密碼錯誤
细粉条
2020-07-02 17:44:07
trigger for update
觸發器在 for update 時 select from inserted 或 deleted 都可以在select語句中是沒有updated的。(
jshang
2020-06-14 02:28:02
微信支付元轉分的正確姿勢
雨果是程序员
2020-06-02 05:11:03
java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException
雨果是程序员
2020-05-19 19:02:35
【Git】git pull拉取代碼時衝突
游骑小兵
2020-05-16 19:13:08
【Q&A】Maven 打包錯誤:Failed to collect dependencies at org.springframework.integration
游骑小兵
2020-05-12 23:51:06
[Q&A] 在Jupyter Notebook中安裝第三方庫
TreasureAI
2020-04-12 02:58:34
怎麼把Listview中的記錄前checkbox打鉤的記錄選出來
jshang
2020-02-26 00:36:57
delphi調用sql存儲過程,並獲取結果
jshang
2020-02-26 00:36:57
[!] Invalid `Podfile` file: undefined method `inherit!' for #. Updati
细粉条
2020-02-24 21:58:31
py 配置文件中編寫不完善、或格式錯誤會引發程序異常
Fergus-Firechan
2020-02-24 13:51:35
24小時熱門文章
-
再談23種設計模式(3):行爲型模式(學習筆記)
-
Power Automate Desktop 安裝完,登錄後老是提示one driver 錯誤
-
微前端學習筆記(4):從微前端到微模塊之EMP與hel-micro方案探索
-
微前端學習筆記(1):微前端總體架構概述,從微服務發微
-
985 碩士程序員,空窗 4 個月沒有 Offer!
-
一文搞懂 Spring 循環依賴
-
賽博鬥地主——使用大語言模型扮演Agent智能體玩牌類遊戲。
-
VScode右鍵打開(添加到右鍵)
-
記一次 .NET某工控視覺自動化系統 卡死分析
-
WindowsServer--SQL Server搭建主從同步實現讀寫分離 - 事務性分發