| changeset 0 | 6f7a81934006 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/mystring/strip.cc Wed Jan 16 22:39:43 2008 +0100 @@ -0,0 +1,13 @@ +#include "mystring.h" +#include <ctype.h> + +mystring mystring::strip() const +{ + const char* start = rep->buf; + while(*start && isspace(*start)) + ++start; + const char* end = rep->buf + rep->length - 1; + while(end >= start && isspace(*end)) + --end; + return mystring(start, end-start+1); +}