From e00506b0ad7a40f8e876542e40ac85ab1979adb5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 31 Dec 2009 23:43:09 +0000 Subject: [PATCH] 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 --- libs/pbd/strsplit.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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& 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); }