mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Fixed bugs in getStringFromVector, getVectorFromString
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1907 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
399d1b73cf
commit
4e2d777c51
@ -1,3 +1,8 @@
|
||||
2001-04-09 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* helper_funcs.C (getStringFromVector, getVectorFromString): fixed bugs
|
||||
and made more robust.
|
||||
|
||||
2001-04-05 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* ControlToc.C:
|
||||
|
@ -35,9 +35,13 @@ string const getStringFromVector(vector<string> const & vec,
|
||||
string const & delim)
|
||||
{
|
||||
string str;
|
||||
for (vector<string>::size_type i=0; i<vec.size(); ++i) {
|
||||
if (i > 0) str += delim;
|
||||
str += vec[i];
|
||||
int i = 0;
|
||||
for (vector<string>::const_iterator it = vec.begin();
|
||||
it != vec.end(); ++it) {
|
||||
if (it->empty()) continue;
|
||||
|
||||
if (i++ > 0) str += delim;
|
||||
str += *it;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ -51,8 +55,10 @@ vector<string> const getVectorFromString(string const & str,
|
||||
for(;;) {
|
||||
string::size_type const idx = keys.find(delim);
|
||||
if (idx == string::npos) break;
|
||||
|
||||
vec.push_back(keys.substr(0, idx));
|
||||
|
||||
string const key = keys.substr(0, idx);
|
||||
if (!key.empty())
|
||||
vec.push_back(key);
|
||||
|
||||
string::size_type const start = idx + delim.size();
|
||||
keys = keys.substr(start);
|
||||
|
Loading…
x
Reference in New Issue
Block a user