Created ifNextIgnoreCase method for ZString.
This commit is contained in:
parent
bf4ff3fdac
commit
2e8bb4a123
18
ZString.cpp
18
ZString.cpp
@ -383,15 +383,6 @@ namespace coreutils {
|
|||||||
return string == std::string(data, length);
|
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) {
|
bool ZString::ifNext(ZString value) {
|
||||||
if (((data + length) - cursor) < value.getLength())
|
if (((data + length) - cursor) < value.getLength())
|
||||||
return false;
|
return false;
|
||||||
@ -401,6 +392,15 @@ namespace coreutils {
|
|||||||
return test;
|
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 ZString::ifEqualsCount(ZString &comparator) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (cursor < (data + length)) {
|
while (cursor < (data + length)) {
|
||||||
|
12
ZString.h
12
ZString.h
@ -296,18 +296,18 @@ namespace coreutils {
|
|||||||
/// the cursor position is equal to the value provided.
|
/// the cursor position is equal to the value provided.
|
||||||
///
|
///
|
||||||
|
|
||||||
// bool ifNext(const char *value);
|
|
||||||
|
|
||||||
///
|
|
||||||
///
|
|
||||||
///
|
|
||||||
|
|
||||||
bool ifNext(ZString value);
|
bool ifNext(ZString value);
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
|
bool ifNextIgnoreCase(ZString value);
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
int ifEqualsCount(ZString &comparator);
|
int ifEqualsCount(ZString &comparator);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user