bool dhstring_contains(DHString *string, DHString *otherString) { if (_string_is_null_or_empty(string) || _string_is_null_or_empty(otherString)) { return false; } else { const unsigned int stringLength = _string_length(string); const unsigned int otherStringLength = _string_length(otherString); if (stringLength < otherStringLength) { return false; } else { int stringIndex; for (stringIndex = 0; stringIndex < stringLength; stringIndex++) { int otherStringIndex = 0; if (_string_char_at(string, stringIndex) == _string_char_at(otherString, otherStringIndex)) { int tempStringIndex = stringIndex; for (otherStringIndex = 0; otherStringIndex < otherStringLength; otherStringIndex++) { if (_string_char_at(string, tempStringIndex) == _string_char_at(otherString, otherStringIndex)) { tempStringIndex++; } else { break; } } if (otherStringIndex == otherStringLength) { return true; } } } } return false; } }
EString _EString_new(const char* _str, const char* _file_name, euint32 _file_line) { euint32 length = _string_length(_str); estring* ret = (estring*)_Malloc(sizeof(estring) + length + 1, _file_name, (euint32)_file_line); ret->length = length; memcpy(&ret->str[0], _str, length + 1); return &ret->str[0]; }