44 lines
923 B
C
44 lines
923 B
C
#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])
|
|
{
|
|
if(string1[index] == ZERO) return TRUE;
|
|
++index;
|
|
}
|
|
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;
|
|
++index;
|
|
}
|
|
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;
|
|
}
|