start counting from offset 0 string.codepoint_offset(S, 0, 0, 0); Char = a string.codepoint_offset(S, 0, 1, 1); Char = 😀 string.codepoint_offset(S, 0, 2, 5); Char = b string.codepoint_offset(S, 0, 3, 6); Char = 0xfffd string.codepoint_offset(S, 0, 4, 7); Char = 0xfffd string.codepoint_offset(S, 0, 5, 8); Char = 0xfffd string.codepoint_offset(S, 0, 6, 9); Char = z string.codepoint_offset(S, 0, 7, _) failed start counting from offset 1 string.codepoint_offset(S, 1, 0, 1); Char = 😀 string.codepoint_offset(S, 1, 1, 5); Char = b string.codepoint_offset(S, 1, 2, 6); Char = 0xfffd string.codepoint_offset(S, 1, 3, 7); Char = 0xfffd string.codepoint_offset(S, 1, 4, 8); Char = 0xfffd string.codepoint_offset(S, 1, 5, 9); Char = z string.codepoint_offset(S, 1, 6, _) failed start counting from offset 2 string.codepoint_offset(S, 2, 0, 2); Char = 0xfffd string.codepoint_offset(S, 2, 1, 3); Char = 0xfffd string.codepoint_offset(S, 2, 2, 4); Char = 0xfffd string.codepoint_offset(S, 2, 3, 5); Char = b string.codepoint_offset(S, 2, 4, 6); Char = 0xfffd string.codepoint_offset(S, 2, 5, 7); Char = 0xfffd string.codepoint_offset(S, 2, 6, 8); Char = 0xfffd string.codepoint_offset(S, 2, 7, 9); Char = z string.codepoint_offset(S, 2, 8, _) failed