日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

Kotlin 擴(kuò)展函數(shù) 之 可空

作者:安果移不動(dòng) 更新時(shí)間: 2022-05-12 編程語(yǔ)言
fun String?.printWithDefault(default: String) = print(this ?: default);


fun  T.easyPrint(): T {
    println(this)
    return this
}

fun main() {
   val str=null;
    str.printWithDefault("1324")
    "狗蛋".printWithDefault("1324")

}

?

原文鏈接:https://blog.csdn.net/mp624183768/article/details/124068415

欄目分類
最近更新