2023-12-02 14:57:43 +00:00
|
|
|
#include <librr/strutil.h>
|
|
|
|
|
|
|
|
usz_t rr_measure_string(const char *string)
|
|
|
|
{
|
|
|
|
usz_t index = 0;
|
|
|
|
while(string[index] != ZERO)
|
|
|
|
++index;
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t rr_strings_equal(const char *string1, const char *string2)
|
|
|
|
{
|
|
|
|
usz_t index = 0;
|
|
|
|
while(string1[index] == string2[index])
|
2023-12-14 21:03:32 +00:00
|
|
|
{
|
2023-12-02 14:57:43 +00:00
|
|
|
if(string1[index] == ZERO) return TRUE;
|
2023-12-14 21:03:32 +00:00
|
|
|
++index;
|
|
|
|
}
|
2023-12-02 14:57:43 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t rr_strings_equal_up_to(const char *string1, const char *string2, usz_t max_length)
|
|
|
|
{
|
|
|
|
usz_t index = 0;
|
|
|
|
while(string1[index] == string2[index])
|
|
|
|
{
|
|
|
|
if(string1[index] == ZERO) return TRUE;
|
|
|
|
if(index >= max_length) return TRUE;
|
2023-12-14 21:03:32 +00:00
|
|
|
++index;
|
2023-12-02 14:57:43 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool_t rr_string_is_prefixed(const char *base, const char *prefix)
|
|
|
|
{
|
|
|
|
usz_t index = 0;
|
|
|
|
while(base[index] == prefix[index])
|
|
|
|
{
|
|
|
|
if(prefix[index] == ZERO) return TRUE;
|
|
|
|
++index;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|