let str = "𩸽だいすき!" let idx = str.index(str.startIndex, offsetBy: 1) str.utf8.distance(from: str.startIndex, to: idx) // 4 str.utf16.distance(from: str.startIndex, to: idx) // 2 str.unicodeScalars.distance(from: str.startIndex, to: idx) // 1 str.distance(from: str.startIndex, to: idx)