LoginSignup
16
14

More than 5 years have passed since last update.

[Swift] 文字列の分割

Posted at
var str = "a b c"
var arr = split(str) {$0 == " "}
// => [a,b,c]
import Foundation
var arr = str.componentsSeparatedByString(" ")
// => [a,b,c]

どっちでもできるけど、下の方が綺麗な感じがします。

16
14
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
14