StrContains
StrContains
Description
Check if string contains another Str.
Parameters
| Name | Direction | Description |
|---|---|---|
s |
in | Str object to search in. |
key |
in | Str object to search for. |
Success
true if a match exists.
Failure
false
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Str.c:168:
}
bool StrContains(const Str *s, const Str *key) {
if (!key) {
LOG_FATAL("Invalid arguments");- In
Str.Ops.c:93:
// Test string contains/index functions
bool test_str_contains_index(void) {
WriteFmt("Testing StrContains and StrIndexOf variants\n");
Str haystack = StrInitFromZstr("Hello World");- In
Str.Ops.c:98:
Str needle = StrInitFromZstr("World");
bool result = StrContains(&haystack, &needle);
result = result && StrContainsZstr(&haystack, "Hello");
result = result && StrContainsCstr(&haystack, "lo Wo", 5);
Last updated on