Swift - starts
2020. 7. 13. 10:30ㆍLanguage/Swift
반응형
starts(with:)
Returns a Boolean value indicating whether the initial elements of the sequence are the same as the elements in another sequence.
시퀀스의 초기 요소가 다른 시퀀스의 요소와 같은지 여부를 나타내는 부울 값을 반환한다.
func starts<PossiblePrefix>(with possiblePrefix: PossiblePrefix)
-> Bool where PossiblePrefix : Sequence, Self.Element == PossiblePrefix.Element
let a = 1...3
let b = 1...10
print(b.starts(with: a))
// Prints "true"
print(b.starts(with: []))
// Prints "true"
반응형
'Language > Swift' 카테고리의 다른 글
Swift - Prefix (0) | 2020.07.13 |
---|---|
Swift - 고급() 연산자 (0) | 2020.07.07 |
Swift - zip (0) | 2020.07.06 |
Swift - flatMap, compactMap (0) | 2020.07.02 |
Swift - stride (0) | 2020.07.01 |