>>4,5
No, strspn doesn't do what I want, even if I switch the arguments around--it's based on equality. Nor does strcspn do it either, it just returns an offset instead of a pointer.
I'm going to name them as strxchr, strnxchr, strrxchr, strnrxchr, etc.
Name:
Anonymous2012-06-05 8:03
Why not just search_pattern(char *s, bool (*foo)(char)) ?
Name:
Anonymous2012-06-05 8:11
>>10
Actually, never mind, the shitty documentation I was looking at had the same description for strspn and strcspn. I'm now going to call them strcchr, etc.
>The following names are grouped under individual headers for convenience.
>All external names described below are reserved no matter what headers are included by the program.
...
7.31.12 General utilities <stdlib.h> Function names that begin with str and a lowercase letter may be added to the declarations in the <stdlib.h> header.
>7.31.13 String handling <string.h> Function names that begin with str, mem, or wcs and a lowercase letter may be added to the declarations in the <string.h> header.
HAHAHAH THE STANDARD WINS AGAIN!
*DANCES AROUND IN CIRCLES WITH RICHARD STALLMAN AND THE SUSSMAN*
Name:
Anonymous2012-06-05 10:45
>>11
That's functionally good enough, but performance wise, I need something without additional call overhead per character. Doing some large scale data file processing and symbol parsing. It's not hard to roll your own strchr style functions, I just needed a good name for them.
for ( ; n > 0; ++s, --n) {
if (*s != c) {
return s;
}
}
return nullptr;
}
Name:
Anonymous2012-06-05 10:45
>>14
He's just making his library so that including it is mutually exclusive with including stdlib and string, nobody uses those anyway.
Name:
Anonymous2012-06-05 10:50
>>14
I'm programming in C++11, and I have added these functions into my own namespace. The fully qualified names are ::<my namespace>::strcchr, etc. Thus, they do not conflict with the Standard C library reserved names.
Despite C++ sucking a lot, this is one of those cases where C++ clearly wins!.