「Kotlin」split()で文字列を半角スペースで区切るサンプル

2021年7月13日

書式
文字列.split(" “)
使用例

fun main() {

    val cft = "study skill in arkgame com"

    val resLst = cft.split(" ")
      println("半角スペースで区切るリスト")
    for (res in resLst) {
        print(res +" ") 
      }
}

実行結果
>kotlin arkgame.jar
半角スペースで区切るリスト
study skill in arkgame com

Kotlin

Posted by arkgame