Created ifNextIgnoreCase method for ZString.

This commit is contained in:
Brad Arant 2024-11-05 15:44:51 -08:00
parent bf4ff3fdac
commit 2e8bb4a123
2 changed files with 15 additions and 15 deletions

View File

@ -383,15 +383,6 @@ namespace coreutils {
return string == std::string(data, length);
}
// bool ZString::ifNext(const char *value) {
// if (((data + length) - cursor) < strlen(value)/)
// return false;
// bool test = (strncmp(cursor, value, strlen(value)) == 0);
// if (test)
// cursor += strlen(value);
// return test;
// }
bool ZString::ifNext(ZString value) {
if (((data + length) - cursor) < value.getLength())
return false;
@ -400,6 +391,15 @@ namespace coreutils {
cursor += value.getLength();
return test;
}
bool ZString::ifNextIgnoreCase(ZString value) {
if (((data + length) - cursor) < value.getLength())
return false;
bool test = (strncasecmp(cursor, value.getCursor(), value.getLength()) == 0);
if (test)
cursor += value.getLength();
return test;
}
int ZString::ifEqualsCount(ZString &comparator) {
int count = 0;

View File

@ -296,18 +296,18 @@ namespace coreutils {
/// the cursor position is equal to the value provided.
///
// bool ifNext(const char *value);
///
///
///
bool ifNext(ZString value);
///
///
///
bool ifNextIgnoreCase(ZString value);
///
///
///
int ifEqualsCount(ZString &comparator);
///