40 lines
877 B
C
40 lines
877 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;
|
||
|
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;
|
||
|
}
|
||
|
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;
|
||
|
}
|