diff options
Diffstat (limited to 'src/code_point.zig')
| -rw-r--r-- | src/code_point.zig | 5 |
1 files changed, 5 insertions, 0 deletions
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 { | |||
| 10 | code: u21, | 10 | code: u21, |
| 11 | len: u3, | 11 | len: u3, |
| 12 | offset: u32, | 12 | offset: u32, |
| 13 | |||
| 14 | /// Return the slice of this codepoint, given the original string. | ||
| 15 | pub fn bytes(cp: CodePoint, str: []const u8) []const u8 { | ||
| 16 | return str[cp.offset..][0..cp.len]; | ||
| 17 | } | ||
| 13 | }; | 18 | }; |
| 14 | 19 | ||
| 15 | /// This function is deprecated and will be removed in a later release. | 20 | /// This function is deprecated and will be removed in a later release. |