summaryrefslogtreecommitdiff
path: root/text/cstr.tnsl
blob: 67db577230dc55b462e39a315fa7e10fc1f39e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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++]
	;/
;/