diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-31 23:43:09 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-31 23:43:09 +0000 |
commit | e00506b0ad7a40f8e876542e40ac85ab1979adb5 (patch) | |
tree | acb6069c0796fdede306fd007f19600609342468 /libs/pbd/strsplit.cc | |
parent | 8ae20c0c4d1353afe2a42f17eb14270882a89174 (diff) |
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
Diffstat (limited to 'libs/pbd/strsplit.cc')
-rw-r--r-- | libs/pbd/strsplit.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/pbd/strsplit.cc b/libs/pbd/strsplit.cc index d30b7356ac..f82abf4c92 100644 --- a/libs/pbd/strsplit.cc +++ b/libs/pbd/strsplit.cc @@ -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); } |