프로그래머스 (Swift)/기초
[Day17-4] 공백으로 구분하기 1
은더기
2024. 4. 28. 16:33
문제

내 정답 코드
import Foundation
func solution(_ my_string:String) -> [String] {
return my_string.components(separatedBy: " ")
}
#
1. components함수의 존재를 늦게 알아차리는 바람에 고생하다가 해결한 문제..
배운 기술
1. components(separatedBy: )
https://developer.apple.com/documentation/foundation/nsstring/1413214-components
components(separatedBy:) | Apple Developer Documentation
Returns an array containing substrings from the receiver that have been divided by a given separator.
developer.apple.com