summaryrefslogtreecommitdiff
path: root/src/CaseFold.zig
diff options
context:
space:
mode:
authorGravatar Jose Colon Rodriguez2024-03-31 09:59:51 -0400
committerGravatar Jose Colon Rodriguez2024-03-31 09:59:51 -0400
commit200c617c865a5952f0bd12378802cc06ea3eb1c2 (patch)
tree2af456d4c62a08330cf961e7237f083fc4566370 /src/CaseFold.zig
parentSplit out Unicode tests to separate file (diff)
downloadzg-200c617c865a5952f0bd12378802cc06ea3eb1c2.tar.gz
zg-200c617c865a5952f0bd12378802cc06ea3eb1c2.tar.xz
zg-200c617c865a5952f0bd12378802cc06ea3eb1c2.zip
Updated README
Diffstat (limited to 'src/CaseFold.zig')
-rw-r--r--src/CaseFold.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/CaseFold.zig b/src/CaseFold.zig
index 9b10e16..3e7535e 100644
--- a/src/CaseFold.zig
+++ b/src/CaseFold.zig
@@ -10,7 +10,9 @@ fold_data: *const FoldData,
10 10
11const Self = @This(); 11const Self = @This();
12 12
13fn caseFold( 13/// Produces the case folded code points for `cps`. Caller must free returned
14/// slice with `allocator`.
15pub fn caseFold(
14 self: Self, 16 self: Self,
15 allocator: mem.Allocator, 17 allocator: mem.Allocator,
16 cps: []const u21, 18 cps: []const u21,
@@ -37,6 +39,8 @@ fn changesWhenCaseFolded(self: Self, cps: []const u21) bool {
37 } else false; 39 } else false;
38} 40}
39 41
42/// Caseless compare `a` and `b` by decomposing to NFKD. This is the most
43/// comprehensive comparison possible, but slower than `canonCaselessMatch`.
40pub fn compatCaselessMatch( 44pub fn compatCaselessMatch(
41 self: Self, 45 self: Self,
42 allocator: mem.Allocator, 46 allocator: mem.Allocator,
@@ -108,6 +112,8 @@ test "compatCaselessMatch" {
108 try testing.expect(try caser.compatCaselessMatch(allocator, &n, a, c)); 112 try testing.expect(try caser.compatCaselessMatch(allocator, &n, a, c));
109} 113}
110 114
115/// Performs canonical caseless string matching by decomposing to NFD. This is
116/// faster than `compatCaselessMatch`, but less comprehensive.
111pub fn canonCaselessMatch( 117pub fn canonCaselessMatch(
112 self: Self, 118 self: Self,
113 allocator: mem.Allocator, 119 allocator: mem.Allocator,