Kotlin string 字串處理 String.format

字串處理整理

從 Java 轉到 Kotlin , format 使用方法不太一樣

Java 用法

String.format("Date %s TODO %s", "2022-01-06", "處理字串");

Kotlin 用法

// 定義 TAG
private TAG = this::class.java.SimpleName
// 列印字串
Log.d(TAG, "Date : %s TODO : %s".format("2022-01-06", "處理字串"));

留言

熱門文章

TourCard 開通全紀錄 台胞證 支付寶

[ 教學 ] 如何使用 Sourcetree 對 Github 進行版本控制 #Mac OS 版本控制