Compare commits

...

3 commits
v1.1.1 ... main

Author SHA1 Message Date
d02dc51456
Add more tests for small strings. 2025-01-08 23:35:25 +01:00
a269c141c8
Add a license. 2025-01-08 23:13:15 +01:00
eac629f456
Fix import in utf8ToAscii example. 2025-01-08 23:07:41 +01:00
3 changed files with 12 additions and 1 deletions

9
LICENSE Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright (c) 2024 Zeptotech
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -22,7 +22,7 @@ std.debug.print("{s}", .{ascii}); // Output: "F".
```zig
const std = @import("std");
const anyascii = @import("anyascii").utf8ToAscii;
const utf8ToAscii = @import("anyascii").utf8ToAscii;
// A full string of UTF-8 characters to ASCII characters.
const ascii = try utf8ToAscii(allocator, "Blöße");

View file

@ -70,6 +70,8 @@ fn testAnyascii(expectedAscii: []const u8, utf8str: []const u8) !void {
test utf8ToAscii {
// These examples are taken from anyascii examples, see https://github.com/anyascii/anyascii/tree/master#examples
try testUtf8ToAscii("a ", "à ");
try testUtf8ToAscii("a", "à");
try testUtf8ToAscii("Rene Francois Lacote", "René François Lacôte");
try testUtf8ToAscii("Blosse", "Blöße");
try testUtf8ToAscii("Tran Hung Dao", "Trần Hưng Đạo");