Lars Gullik Bjønnes wrote:

> 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...


where is the difference?

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


is better than substr because it causes no out of range exception.
-> the only difference ...

> 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).


If we have a "real" bibtex entry there is always a "=". The problem
was, that parseBibtex() was called without any need. The lyxlayout
"Bibliography" is far different to bibtex entries.

Herbert



-- 
http://www.lyx.org/help/

Reply via email to