File: strip.cc

package info (click to toggle)
nullmailer 1%3A1.03-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,524 kB
  • ctags: 695
  • sloc: cpp: 4,484; sh: 4,123; makefile: 224; perl: 184
file content (13 lines) | stat: -rw-r--r-- 296 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
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);
}