X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fstrsplit.cc;h=f82abf4c92430b7c64014c4c4eb21f70a4d1e22d;hb=31e203ac07cbda216fc842c68b9192d082ba8d65;hp=1fb61121501d63419ae6f27f2db6162920727ab9;hpb=2aba860ba1603cb84efc5d0212bf97493aa0bf46;p=ardour.git diff --git a/libs/pbd/strsplit.cc b/libs/pbd/strsplit.cc index 1fb6112150..f82abf4c92 100644 --- a/libs/pbd/strsplit.cc +++ b/libs/pbd/strsplit.cc @@ -1,4 +1,23 @@ -#include +/* + Copyright (C) 2000-2007 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "pbd/strsplit.h" using namespace std; using namespace Glib; @@ -30,8 +49,10 @@ split (string str, vector& result, char splitchar) remaining = str; - while ((pos = remaining.find_first_of (':')) != string::npos) { - result.push_back (remaining.substr (0, pos)); + while ((pos = remaining.find_first_of (splitchar)) != string::npos) { + if (pos != 0) { + result.push_back (remaining.substr (0, pos)); + } remaining = remaining.substr (pos+1); } @@ -68,7 +89,7 @@ split (ustring str, vector& result, char splitchar) remaining = str; - while ((pos = remaining.find_first_of (':')) != ustring::npos) { + while ((pos = remaining.find_first_of (splitchar)) != ustring::npos) { result.push_back (remaining.substr (0, pos)); remaining = remaining.substr (pos+1); }