John Levon <[EMAIL PROTECTED]> writes:

| On Tue, Mar 05, 2002 at 01:35:22PM +0100, Lars Gullik Bjønnes wrote:
>
>> anyway... imagine what happens here if data does not contain a '=' or
>> if data is empty.
>> 
>> biblio.C: 356
>> data = data.substr(data.find('='), data.length() - 1);
>
| I've never understood why the STL can't handle this, it causes so much
| more typing ...

In this case you should think about what you are doing...

do you want a substring _or_ do you want to get rid of part of the
string...

data.erase(data.find('='), string::npos));

but of course I am not sure that this works either if a '=' is not
found. What we need to check then is if data.erase(string::npos,
string::npos) is valied (and I guess that it is not).

-- 
        Lgb

Reply via email to