13
0
livetrax/libs/pbd3/whitespace.cc
Taybin Rutkin 6817b59169 Moved strip_whitespace_edges() to pbd/whitespace.h
Gtkmm2ext::Prompter::get_result() calls strip_whitespace_edges(), so you don't have to.
Removed unused/unecessary/forgotten headers from libpbd.


git-svn-id: svn://localhost/trunk/ardour2@270 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-01-13 19:48:55 +00:00

31 lines
489 B
C++

#include <pbd/whitespace.h>
using namespace std;
void
strip_whitespace_edges (string& str)
{
string::size_type i;
string::size_type len;
string::size_type s;
len = str.length();
for (i = 0; i < len; ++i) {
if (isgraph (str[i])) {
break;
}
}
s = i;
for (i = len - 1; i >= 0; --i) {
if (isgraph (str[i])) {
break;
}
}
str = str.substr (s, (i - s) + 1);
}