I don't want to include just for std::find_first_of() and unfortunately there's no equivalent in the C string library. Coming close are strpbrk() or strcspn() but both of them work with null-terminated strings, which is absolutely useless here, not to mention that both do *exactly* the same thing, with one returning a pointer but the other an offset, so what's the point
| 719 | for that case. Yes, std::string::find_first_of() probably would have that, |
| 720 | but I'd first need to allocate to make use of that and FUCK NO. */ |
| 721 | const char* stringFindAny(const char* const data, const std::size_t size, const char* const characters, const std::size_t characterCount) { |
| 722 | for (const char* i = data, *end = data + size; i != end; ++i) |
| 723 | if (std::memchr(characters, *i, characterCount)) return i; |
| 724 | return {}; |
| 725 | } |
| 726 | |
| 727 | // Variants of the above. Not sure if those even have any vaguely corresponding C lib API. Probably not. |
| 728 |
no outgoing calls
no test coverage detected