summaryrefslogtreecommitdiff
path: root/text/cstr.tnsl
diff options
context:
space:
mode:
Diffstat (limited to 'text/cstr.tnsl')
-rw-r--r--text/cstr.tnsl31
1 files changed, 31 insertions, 0 deletions
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++]
+ ;/
+;/