1 proc string.length uses ebx, _str
\r
14 proc string.copy uses eax ebx ecx, _src, _dst
\r
29 proc string.concatenate uses eax, _src, _dst
\r
30 stdcall string.length, [_dst]
\r
32 stdcall string.copy, [_src], eax
\r
36 proc string.cmp uses ecx esi edi, _str1, _str2, _n
\r
38 test ecx, ecx ; Max length is zero?
\r
41 mov esi, [_str1] ; esi = string s1
\r
42 mov edi, [_str2] ; edi = string s2
\r
45 cmpsb ; Compare two bytes
\r
47 cmp byte [esi-1], 0 ; End of string?
\r
49 dec ecx ; Length limit reached?
\r
52 seta al ; al = (s1 > s2)
\r
53 setb ah ; ah = (s1 < s2)
\r
55 movsx eax, al ; eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1
\r
59 proc string.to_lower_case uses eax, _str
\r
68 add [eax], byte 97 - 65
\r
76 proc string.to_upper_case uses eax, _str
\r
85 sub [eax], byte 97 - 65
\r
93 proc string.match uses ebx ecx edx, _str1, _str2
\r
103 cmp [ecx], byte '?'
\r
105 cmp [ecx], byte '*'
\r
110 cmp [ecx - 1], byte '*'
\r
129 cmp [ecx], byte '*'
\r
144 proc string.trim_last uses eax, _str
\r
145 stdcall string.length, [_str]
\r
149 cmp [eax], byte ' '
\r
158 proc string.trim_first, _str
\r
161 cmp [eax], byte ' '
\r
169 proc string.index_of uses ebx ecx, _str, _char, _num
\r
190 proc string.last_index_of uses ebx ecx, _str, _char, _num
\r
191 stdcall string.length, [_str]
\r