You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'subscript(_:)' is unavailable: cannot subscript String with an Int,use a String.Index instead.
//**'subscript(_:)'를 사용할 수 없습니다. String을 Int로 첨자할 수 없습니다. 대신 String.Index를 사용하세요.**
따라서 String.Index를 사용하여 문자열의 인덱스에 접근할 수 있다.
init(utf16Offset:in:)
index를 복잡하게 구하지 않고 정수(Int)를 이용하여 쉽게 구할 수 있는 이니셜라이저
📌 TODO
가운데 글자 가져오기
💬 Idea
💬 풀이
소요시간
: 20분 4초💬 더 나은 방법?
💬 알게된 문법
✅ String.Index
지정된 UTF-16 코드 단위 오프셋에서 새 인덱스를 만든다.
Swift 문자열에서는 string[0]과 같이 index를 통한 접근이 불가능하다.
따라서 String.Index를 사용하여 문자열의 인덱스에 접근할 수 있다.
index를 복잡하게 구하지 않고 정수(Int)를 이용하여 쉽게 구할 수 있는 이니셜라이저
✅ Array(s)
The text was updated successfully, but these errors were encountered: