Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #43589

Re: A case insensitive substring search?

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c++
Subject Re: A case insensitive substring search?
Date Wed, 29 Jun 2016 10:56:21 +0100
Organization A noiseless patient Spider
Lines 31
Message-ID <871t3ggvy2.fsf@bsb.me.uk> (permalink)
References <C6mdnaL0a8umRu_KnZ2dnUU7-cHNnZ2d@giganews.com> <877fd9gcav.fsf@bsb.me.uk> <8tadndSUROtJxu7KnZ2dnUU7-X3NnZ2d@giganews.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="17910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QspW0uu83nwQ4beU3+4vsmib703VxUnw="
Cancel-Lock sha1:W5kXRV74NF5iuDvDBBZagYhn0xo= sha1:SRRRNNDvIBA6SRazrMt6Y1VKOz0=
X-BSB-Auth 1.cef4e9468b2cd3aee72a.20160629105621BST.871t3ggvy2.fsf@bsb.me.uk
Xref csiph.com comp.lang.c++:43589

Show key headers only | View raw


James Moe <jimoeDESPAM@sohnen-moe.com> writes:

> On 06/28/2016 03:48 PM, Ben Bacarisse wrote:
>> You need search, not search_n.
>>
>   Tried that. No luck.
> bool strstricmp (string & s1, string & sub2)
> {
>     string::iterator pos;
>
>     pos = search(s1.begin, s1.end(),
> 		   sub2.begin(), sub2.end(),
> 		   icompare);
>     return (pos != s1.end());
> }
>   Complains that there is no match for the predicate.

Seems odd.  I'd expect more problems to come from the missing () after
s1.begin.  When I fix that, it works here.

You should consider making s1 and sub2 references to const.

>> And if you are using modern C++ you can [...]
>> 
>   Alas, no. g++ 4.7.3.

The [...] went on to suggest using an anonymous function.  I thought
these were introduced in gcc 4.5.

-- 
Ben.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A case insensitive substring search? James Moe <jimoeDESPAM@sohnen-moe.com> - 2016-06-28 13:16 -0700
  Re: A case insensitive substring search? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-28 23:48 +0100
    Re: A case insensitive substring search? James Moe <jimoeDESPAM@sohnen-moe.com> - 2016-06-28 22:25 -0700
      Re: A case insensitive substring search? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-06-29 10:56 +0100
        Re: A case insensitive substring search? Öö Tiib <ootiib@hot.ee> - 2016-06-29 04:19 -0700
      Re: A case insensitive substring search? James Moe <jimoeDESPAM@sohnen-moe.com> - 2016-06-29 10:48 -0700
  Re: A case insensitive substring search? Nobody <nobody@nowhere.invalid> - 2016-06-29 00:39 +0100
    Re: A case insensitive substring search? Öö Tiib <ootiib@hot.ee> - 2016-06-29 06:22 -0700
      Re: A case insensitive substring search? Ralf Goertz <me@myprovider.invalid> - 2016-06-29 17:16 +0200
        Re: A case insensitive substring search? Öö Tiib <ootiib@hot.ee> - 2016-07-01 01:46 -0700
    Re: A case insensitive substring search? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-06-29 21:32 +0200
    Re: A case insensitive substring search? Nobody <nobody@nowhere.invalid> - 2016-07-01 07:53 +0100

csiph-web