From 481f7c39655afec832ac10430dd61a3bb464aa58 Mon Sep 17 00:00:00 2001 From: Taybin Rutkin Date: Thu, 29 Jun 2006 22:21:30 +0000 Subject: Fixed i18n system. Renamed pbd3 back to pbd, since it's version 4.1 now. Very minor fixes git-svn-id: svn://localhost/ardour2/trunk@656 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/strsplit.cc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 libs/pbd/strsplit.cc (limited to 'libs/pbd/strsplit.cc') diff --git a/libs/pbd/strsplit.cc b/libs/pbd/strsplit.cc new file mode 100644 index 0000000000..7f29a77887 --- /dev/null +++ b/libs/pbd/strsplit.cc @@ -0,0 +1,41 @@ +#include + +using namespace std; + +void +split (string str, vector& result, char splitchar) +{ + string::size_type pos; + string remaining; + string::size_type len = str.length(); + int cnt; + + cnt = 0; + + if (str.empty()) { + return; + } + + for (string::size_type n = 0; n < len; ++n) { + if (str[n] == splitchar) { + cnt++; + } + } + + if (cnt == 0) { + result.push_back (str); + return; + } + + remaining = str; + + while ((pos = remaining.find_first_of (':')) != string::npos) { + result.push_back (remaining.substr (0, pos)); + remaining = remaining.substr (pos+1); + } + + if (remaining.length()) { + + result.push_back (remaining); + } +} -- cgit v1.2.3