why isn't there a strcasestr ? 
Author Message
 why isn't there a strcasestr ?

Hello,

From my knowledge there isn't a strcasestr (stristr), so obviously I
got to work and wrote some simple code and hey presto, I've got a
strcasestr function.

But my question is, if they have a string case comparison, and a strstr
function, why not a strcasestr function ??  Was it decided that the
performace of it would far outweigh is use or am I the only person who
thinks it would be a laugh to have strcasestr included....

-Paul



Thu, 26 Apr 2001 03:00:00 GMT  
 why isn't there a strcasestr ?

   From my knowledge there isn't a strcasestr (stristr), so obviously I
   got to work and wrote some simple code and hey presto, I've got a
   strcasestr function.

I hope you didn't name it that, strcasestr is a reserved identifier.

   But my question is, if they have a string case comparison, and a strstr
   function, why not a strcasestr function ??  Was it decided that the
   performace of it would far outweigh is use or am I the only person who
   thinks it would be a laugh to have strcasestr included....

It probably just never occurred to K&R, or they thought adding it
would have marginal benefits.  After all, they do provide the
necessary tools to build it in ctype.h.
--
"In My Egotistical Opinion, most people's C programs should be indented six
 feet downward and covered with dirt." -- Blair P. Houghton
Please: do not email me copies of your posts to comp.lang.c
        do not ask me C questions via email; post them instead



Thu, 26 Apr 2001 03:00:00 GMT  
 why isn't there a strcasestr ?


Quote:
>Hello,

>From my knowledge there isn't a strcasestr (stristr), so obviously I
>got to work and wrote some simple code and hey presto, I've got a
>strcasestr function.

>But my question is, if they have a string case comparison,

They don't. The only case related functions are character related functions
in <ctype.h> such as isupper() and tolower(). Some platforms provide
stricmp() or strcasecmp() functions but these are non-standard extensions.

--
-----------------------------------------


-----------------------------------------



Thu, 26 Apr 2001 03:00:00 GMT  
 why isn't there a strcasestr ?
my understanding is that all of the case-sensitive string functions were NOT
ANSI, they are compiler-dependent features.  In fact I have seen people that
want to use them while conforming to ANSI write their own and include them in
the project instead of just using what is available.

David

Quote:

> Hello,

> From my knowledge there isn't a strcasestr (stristr), so obviously I
> got to work and wrote some simple code and hey presto, I've got a
> strcasestr function.

> But my question is, if they have a string case comparison, and a strstr
> function, why not a strcasestr function ??  Was it decided that the
> performace of it would far outweigh is use or am I the only person who
> thinks it would be a laugh to have strcasestr included....

> -Paul

--
---------------------------------------------------------------

http://www.ladsoft.com                                     (computer page)
http://www.geocities.com/Area51/Station/5196/index.html    (home page)
http://www.geocities.com/Area51/Station/5196/ttc.html      (tao te ching)



Thu, 26 Apr 2001 03:00:00 GMT  
 why isn't there a strcasestr ?

Quote:
> But my question is, if they have a string case comparison, and a strstr
> function, why not a strcasestr function ??

I believe the reason C has no library support for case sensitive
comparisons is the tremendous overhead localization and language
support would add to it. An ASCII stricmp is trivial, but a
locale-sensitive one is hairy. Remember all the locale stuff was added
to C at the 11th hour. C doesn't have any case insensitive
comparison functions at all.

Scott



Fri, 27 Apr 2001 03:00:00 GMT  
 why isn't there a strcasestr ?

Quote:

>> But my question is, if they have a string case comparison, and a strstr
>> function, why not a strcasestr function ??

>I believe the reason C has no library support for case sensitive
>comparisons is the tremendous overhead localization and language
>support would add to it. An ASCII stricmp is trivial, but a
>locale-sensitive one is hairy. Remember all the locale stuff was added
>to C at the 11th hour. C doesn't have any case insensitive
>comparison functions at all.

Given that toupper() and tolower() already exist there probably
wouldn't be a great overhead in doing this. It just seems that there
was no great drive to add it to the standard library.

--
-----------------------------------------


-----------------------------------------



Fri, 27 Apr 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. NULL isn't 0/0 isn't NULL

2. why isn't stdio full-duplex?

3. Top Left Icon - Why Isn't it Showing Up Correctly

4. Why isn't malloc necessary here?

5. HELP - why isn't ld working

6. Why isn't there a ->= operator?

7. Why isn't this working?

8. Why isn't there a logical XOR?

9. Why isn't one interface registered?

10. Why isn't ICollectionOnSTLImpl thread-safe?

11. Why isn't ATL complete?

12. Why isn't this legal C++

 

 
Powered by phpBB® Forum Software