Add wapp_str8_equal_to_count function
This commit is contained in:
parent
a3d9bcf1a1
commit
a308359942
@ -92,7 +92,15 @@ bool wapp_str8_equal(Str8RO *s1, Str8RO *s2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return memcmp(s1->buf, s2->buf, s1->size) == 0;
|
||||
return wapp_str8_equal_to_count(s1, s2, s1->size);
|
||||
}
|
||||
|
||||
bool wapp_str8_equal_to_count(Str8RO* s1, Str8RO* s2, u64 count) {
|
||||
if (!s1 || !s2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return memcmp(s1->buf, s2->buf, count) == 0;
|
||||
}
|
||||
|
||||
Str8RO wapp_str8_substr(Str8RO *str, u64 start, u64 end) {
|
||||
|
@ -67,6 +67,7 @@ Str8 *wapp_str8_alloc_str8(const Allocator *allocator, Str8RO *str);
|
||||
c8 wapp_str8_get(Str8RO *str, u64 index);
|
||||
void wapp_str8_set(Str8 *str, u64 index, c8 c);
|
||||
bool wapp_str8_equal(Str8RO *s1, Str8RO *s2);
|
||||
bool wapp_str8_equal_to_count(Str8RO* s1, Str8RO* s2, u64 count);
|
||||
Str8RO wapp_str8_substr(Str8RO *str, u64 start, u64 end);
|
||||
Str8 *wapp_str8_concat(const Allocator *allocator, Str8 *dst, Str8RO *src);
|
||||
void wapp_str8_concat_capped(Str8 *dst, Str8RO *src);
|
||||
|
Loading…
Reference in New Issue
Block a user