From cf8d8fe5d640511f6c4134fdaa36e930232ca7da Mon Sep 17 00:00:00 2001 From: Sam Atman Date: Mon, 12 May 2025 15:22:37 -0400 Subject: Begin conformance test I'm not sure the details of this strategy can actually be made to work. But, something can. --- src/code_point.zig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/code_point.zig') diff --git a/src/code_point.zig b/src/code_point.zig index b3c9aea..79ee5cd 100644 --- a/src/code_point.zig +++ b/src/code_point.zig @@ -10,6 +10,11 @@ pub const CodePoint = struct { code: u21, len: u3, offset: u32, + + /// Return the slice of this codepoint, given the original string. + pub fn bytes(cp: CodePoint, str: []const u8) []const u8 { + return str[cp.offset..][0..cp.len]; + } }; /// This function is deprecated and will be removed in a later release. -- cgit v1.2.3