File: strcmp.ha

package info (click to toggle)
harec 0.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,480 kB
  • sloc: ansic: 20,054; asm: 335; makefile: 116; lisp: 80; sh: 45
file content (13 lines) | stat: -rw-r--r-- 257 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
export fn strcmp(a: str, b: str) bool = {
	if (len(a) != len(b)) {
		return false;
	};
	let ln = len(a);
	let a = toutf8(a): *[*]u8, b = toutf8(b): *[*]u8;
	for (let i = 0z; i < ln; i += 1) {
		if (a[i] != b[i]) {
			return false;
		};
	};
	return true;
};