忘東忘西

把會忘記的記錄下來 只是筆記, 不是部落格

2021年5月27日 星期四

swift 5: 字串的 format 方法

 解決方案:

   Swift:字符串格式化 


範例:

  1. let string = "abc"
  2. print(String(format:"%@ ", arguments:[string]))

  3. let num = 10 print(String(format:"%4d", arguments:[num]))


張貼者: Snoopy 於 凌晨1:54
以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook分享到 Pinterest

沒有留言:

張貼留言

較新的文章 較舊的文章 首頁
訂閱: 張貼留言 (Atom)

寫程式時的雜記

Snoopy
檢視我的完整簡介

網誌存檔

  • ►  2023 (23)
    • ►  12月 (1)
    • ►  11月 (17)
    • ►  10月 (5)
  • ►  2022 (2)
    • ►  3月 (2)
  • ▼  2021 (13)
    • ►  6月 (2)
    • ▼  5月 (4)
      • swift 5: Bluetooth Central and Peripheral
      • swift 5: 字串的 format 方法
      • swift 5: iPadOS textField 進入輸入模式(出現 keyboard) 畫面, ...
      • Apple ID 雙重認證及電話號碼 被鎖
    • ►  1月 (7)
  • ►  2020 (8)
    • ►  12月 (6)
    • ►  1月 (2)
  • ►  2019 (48)
    • ►  11月 (3)
    • ►  10月 (14)
    • ►  9月 (2)
    • ►  7月 (6)
    • ►  6月 (18)
    • ►  5月 (5)
  • ►  2018 (12)
    • ►  11月 (1)
    • ►  10月 (6)
    • ►  9月 (5)
  • ►  2017 (8)
    • ►  10月 (8)
  • ►  2016 (73)
    • ►  10月 (3)
    • ►  9月 (4)
    • ►  6月 (3)
    • ►  5月 (7)
    • ►  4月 (25)
    • ►  3月 (31)
  • ►  2015 (18)
    • ►  9月 (5)
    • ►  5月 (3)
    • ►  4月 (1)
    • ►  2月 (6)
    • ►  1月 (3)
  • ►  2014 (6)
    • ►  12月 (6)
輕柔雅緻主題. 技術提供:Blogger.