Strings: add cmp function

This commit is contained in:
DrZlo13 2021-12-07 01:37:12 +10:00
parent 101c415984
commit 1677d0a3b1
2 changed files with 12 additions and 0 deletions

View File

@ -59,6 +59,10 @@ char mstring_get_char(const mstring_t* mstr, size_t index) {
return string_get_char(mstr->str, index); return string_get_char(mstr->str, index);
} }
int mstring_cmp(const mstring_t* mstr, const mstring_t* mstr2) {
return string_cmp(mstr->str, mstr2->str);
}
int mstring_cmp_cstr(const mstring_t* mstr, const char* cstr) { int mstring_cmp_cstr(const mstring_t* mstr, const char* cstr) {
return string_cmp_str(mstr->str, cstr); return string_cmp_str(mstr->str, cstr);
} }

View File

@ -94,6 +94,14 @@ size_t mstring_size(const mstring_t* mstr);
*/ */
char mstring_get_char(const mstring_t* mstr, size_t index); char mstring_get_char(const mstring_t* mstr, size_t index);
/**
* Compare the string to the other string
* @param mstr
* @param mstr2
* @return int
*/
int mstring_cmp(const mstring_t* mstr, const mstring_t* mstr2);
/** /**
* Compare the string to the C string * Compare the string to the C string
* @param mstr * @param mstr