From f56c11b48ac6ef65622d38da2d8d8ff04dd4049d Mon Sep 17 00:00:00 2001 From: Kai Gunger Date: Sat, 11 Jul 2026 16:17:57 -0400 Subject: Some basic modules (sans actual utility) --- text/cstr.tnsl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 text/cstr.tnsl (limited to 'text/cstr.tnsl') diff --git a/text/cstr.tnsl b/text/cstr.tnsl new file mode 100644 index 0000000..67db577 --- /dev/null +++ b/text/cstr.tnsl @@ -0,0 +1,31 @@ + +/; cstr_cmp (~uint8 a, b) [bool] + /; loop (a` == b` && a` !== 0 && b` !== 0) [a++; b++] ;/ + + /; if (b` == 0 && a == 0) + return true + ;/ + + return false +;/ + +/; cstr_len (~uint8 a) [uint] + uint out = 0 + /; loop (str` !== 0) [str++; out++] ;/ + return out +;/ + +/; cstr_starts_with (~uint8 str, prefix) [bool] + int chk = cstr_len(suffix) + int counter = 0 + + /; loop (str` !== 0) [str++] + ;/ + +/; cstr_ends_with (~uint8 str, suffix) [bool] + int chk = cstr_len(suffix) + int counter = 0 + + /; loop (str` !== 0) [str++] + ;/ +;/ -- cgit v1.2.3