Link
Notice
목록superset (1)
HIT해

isSubset내가 속해 있는지 체크isSuperset내가 포함하고 있는지 체크 사용해보자!let totalFriends = ["철수", "영희", "수잔", "제임스"]let foreignFriends = ["수잔", "제임스"]let koreanFriends = ["철수", "영희", "상철"] 이런 배열이 있다고 가정했을때 어떤 배열이 어디에 속할 수 있는지 체크할 수 있다.이때 Array로는 불가능하기에 Set으로 변환해서 알아볼 수 있다. let totalFriendsSet = Set(totalFriends)let foreignFriendsSet = Set(foreignFriends)let koreanFriendsSet = Set(koreanFriends) A.isSubset(of : B) ..
Swift/기초문법
2024. 8. 19. 22:19