Avatar
@swift-main func XCTAssertEqual<T: Equatable>(_ a: T, _ b: T) { guard a == b else { print("\(a) != \(b)") return } } // コ + 半角濁点 let s = "\u{30B3}\u{FF9E}" XCTAssertEqual(s.unicodeScalars.count, 2) XCTAssertEqual(s.count, 1) let indices: [String.Index] = Array(s.indices) + [s.endIndex] XCTAssertEqual(indices.count, 2) let range: Range<String.Index> = s.rangeOfCharacter(from: chars)! XCTAssertEqual(indices.contains(range.lowerBound), true) XCTAssertEqual(indices.contains(range.upperBound), false) // !?