如何將"100,123,124"轉換爲Set[Int]?將字符串更改爲scala中的[int]
"100,123,124"
Set[Int]
來源
2016-04-29 vikash kumar
只需使用:
"100,123,124".split(",").map(_.toInt).toSet
2016-04-29 08:18:35