strsplit(): if first char of a string is the separator, don't push an empty string into the return vector

git-svn-id: svn://localhost/ardour2/branches/3.0@6426 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-12-31 23:43:09 +00:00
parent 8ae20c0c4d
commit e00506b0ad

View file

@ -50,7 +50,9 @@ split (string str, vector<string>& result, char splitchar)
remaining = str;
while ((pos = remaining.find_first_of (splitchar)) != string::npos) {
result.push_back (remaining.substr (0, pos));
if (pos != 0) {
result.push_back (remaining.substr (0, pos));
}
remaining = remaining.substr (pos+1);
}