summaryrefslogtreecommitdiff
path: root/libs/pbd3/whitespace.cc
blob: 7f74940457423833f4a316861f9870b448269c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#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);
}