Created
January 28, 2010 00:06
-
-
Save stepancheg/288294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size_t memspn(const char* s, size_t len, const char* charset) { | |
for (size_t i = 0; i < len; ++i) { | |
bool found = false; | |
for (const char* p = charset; *p != 0; ++p) { | |
if (s[i] == *p) { | |
found = true; | |
break; | |
} | |
} | |
if (!found) | |
return i; | |
} | |
return len; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment